Elements Conversion

array_change_key_case($arr[, $i= CASE_LOWER]) returns a copy of $arr with the keys uppercased or lowercased. $i can be CASE_LOWER or CASE_UPPER. array_flip ($arr) returns an array with the values of $arr as keys, and the keys of $arr as corresponding values. If a value has several occurrences, the latest key will be used as its value. array_unique ($arr [,$i= SORT_STRING]) returns a copy of $arr without all duplicate values. $i can be SORT_REGULAR, SORT_NUMERIC, SORT_STRING, or SORT_LOCALE_STRING. array_filter($arr [,$f($m)=””]) returns a copy of $arr with the key-value pairs filtered out by the function $f. $m corresponds a value in $arr. Only if $f($m) returns true on a value, the value will be added to the returned array. Array keys are preserved. If $f is not supplied, all entries of $arr equal to FALSE will be removed. array_map($f($m1[,$m2……]), $arr1
[,$arr2……])  returns an array that contains the resultant elements after applying $f to each element in $arr1……. The number of parameters that $f accepts should match the number of arrays passed. If $arr1 contains string keys, then the returned array will contain string keys if and only if exactly one array is passed. If $f is NULL, an array of arrays will be returned from the arrays passed. array_walk(&$arr, $f(&$m1,$m2[,$m3])[,$m4= NULL]) applies $f to each element in $arr, with $m1 and $m2 corresponding to the value and key respectively. $m4 is the optional data supplied to $f as the third parameter $m3. Only the values of $arr may be changed, with the reference symbol & added in front of $m1. This function returns TRUE on success. array_walk_recursive(&$arr, $f(&$m1, $m2[,$m3])[,$m4= NULL]) is similar to array_walk() except that the function will recurse into deeper arrays.

<!DOCTYPE html><html><head></head>
<body>
<?php
function filter($m){
   return ($m>'b');
}
function map($m1,$m2){
   return ($m2.' '.$m1);
}
function walk(&$m1,$m2,$m3){
   $m1="$m3 $m1";
}
$a=['a'=>'apple','b'=>'banana','c'=>'pear','d'=>'banana'];
$b=['sweet','nice','delicious','awesome'];
print_r(array_change_key_case($a,CASE_UPPER)); 
                                                           echo "<br /><br />";
print_r(array_flip($a)); echo "<br /><br />";
print_r(array_unique($a)); echo "<br /><br />";
print_r(array_filter($a,'filter')); echo "<br /><br />";
print_r(array_map('map',$a,$b)); echo "<br /><br />";
print_r(array_map(NULL,$a,$b)); echo "<br /><br />";
array_walk($a,'walk','the');
print_r($a);
?> 
</body></html>

Array ( [A] => apple [B] => banana [C] => pear [D] => banana )

Array ( [apple] => a [banana] => d [pear] => c )

Array ( [a] => apple [b] => banana [c] => pear )

Array ( [b] => banana [c] => pear [d] => banana )

Array ( [0] => sweet apple [1] => nice banana [2] => delicious pear [3] => awesome banana )

Array ( [0] => Array ( [0] => apple [1] => sweet ) [1] => Array ( [0] => banana [1] => nice ) [2] => Array ( [0] => pear [1] => delicious ) [3] => Array ( [0] => banana [1] => awesome ) )

Array ( [a] => the apple [b] => the banana [c] => the pear [d] => the banana )