Tutorials Point


  Learning PHP
  Advanced PHP
  PHP Function Reference
  PHP Useful Resources
  Selected Reading

Copyright © 2014 by tutorialspoint



  Home     References     Discussion Forums     About TP  

PHP Function array_change_key_case()


previous

Advertisements

Syntax

array array_change_key_case ( array $input [, int $case] )

Definition and Usage

Returns an array with all keys from input lowercased or uppercased. Numbered indices are left as is.

Paramters

ParameterDescription
inputThe array to work on
caseEither CASE_UPPER or CASE_LOWER (default)

Return Values

Returns an array with its keys lower or uppercased, or false if input is not an array.

Example

Try out following example:

<?php
$input_array = array("FirSt" => 1, "SecOnd" => 4);
print_r(array_change_key_case($input_array, CASE_UPPER));
?> 

This will produce following result:

Array ( [FIRST] => 1 [SECOND] => 4 )

previous Printer Friendly

Advertisements


  

Advertisements