PHP array each() functionThe each( ) function is an inbuilt function of PHP. It is used to fetch the key and value of the current element and moves the internal pointer forward. This function was introduced in PHP 4.0. SyntaxParameter
ReturnsThe each() function returns the current key and value pair from array_name. Example 1Output: Array ( [1] => OS [value] => OS [0] => 0 [key] => 0 ) Example 2Output: Array ( [1] =>sachin [value] =>sachin [0] => 0 [key] => 0 ) Example 3Output: Array ( [1] => dell [value] =>dell [0] => 0 [key] => 0 ) Example 4Output: Array ( [1] =>bengaluru [value] =>bengaluru [0] =>karnataka [key] =>karnataka )
Next TopicPHP Array Functions
|