PHP array functions.
1. array_change_key_case - Changes the case of all keys in an array and not of the values of the array.
Example:
<?php
$input_array = array("Key1" => 1, "Key2" => 2);
print_r(array_change_key_case($input_array, CASE_UPPER));
?>
2.array_chunk - Split an array into chunks.It will divide the array according to argument value that will be pass in this function.
Example1:
<?php
$chunk_array=array("a","b","c","d","e");
print_r(array_chunk($chunk_array,3));
?>
Example2:
<?php
$chunk_array=array("a","b","c","d","e");
print_r(array_chunk($chunk_array,3,true));
?>
No comments:
Post a Comment