over 9 years ago
What is the work of each() function ?
PHP each() function mainly Return the current key and value pair from an array.
Syntax of each() function:
each(array_name)
You can take reference form below example to use of each() function.
- <?php
- //here $Emp_name is a array_name
- $Emp_name = array("Joe","Kallis","Roy","Ramon");
- // now call each() and pass array_name
- print_r (each($Emp_name));
- ?>
<?php //here $Emp_name is a array_name $Emp_name = array("Joe","Kallis","Roy","Ramon"); // now call each() and pass array_name print_r (each($Emp_name)); ?>
output will come following:
Array ( [1] => Joe [value] => Joe [0] => 0 [key] => 0 )
0 Comment(s)