Loading....
<!--?php $array = array(0 =--> 'blue', 1 => 'red', 2 => 'green', 3 => 'red'); $key = array_search('green', $array); // $key = 2; $key = array_search('red', $array); // $key = 1; ?>array_combine : Creates an array by using one array for
<!--?php $a = array('green', 'red', 'yellow'); $b = array('avocado', 'apple', 'banana'); $c = array_combine($a, $b); print_r($c); ?-->The array_slice() function returns selected parts of an array.
</pre> <!--?php $input = array("a", "b", "c", "d", "e"); $output = array_slice($input, 2); // returns "c", "d", and "e" $output = array_slice($input, -2, 1); // returns "d" $output = array_slice($input, 0, 3); // returns "a", "b", and "c" // note the differences in the array keys print_r(array_slice($input, 2, -1)); print_r(array_slice($input, 2, -1, true)); ?--> <pre>Output: Array ( [0] => c [1] => d ) Array ( [2] => c [3] => d ) list — Assign variables as if they were an array
<!--?php list($a, list($b, $c)) = array(1, array(2, 3)); var_dump($a, $b, $c); ?-->end — Set the internal pointer of an array to its last element
<!--?php $fruits = array('apple', 'banana', 'cranberry'); echo end($fruits); // cranberry ?-->Last Update: Posted by: müslüm ÇEN