Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use each() function in php ?

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 143
    Comment on it

    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));
    ?>
    

    output will come following:

    Array ( [1] => Joe [value] => Joe [0] => 0 [key] => 0 )

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: