Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use array_combine() in PHP.

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 157
    Comment on it

    Hello Readers ,

    Suppose we have two array's .

    $fname=array("Peter","Ben","Joe");

    $age=array("35","37","43");

    The array_combine() function creates an array by using the elements from one "keys" array and one "values" array.

    Example :

    <?php
    $fname=array("Peter","Ben","Joe");
    $age=array("35","37","43");
    $c=array_combine($fname,$age);
    print_r($c);
    ?>
    

    Output :

     Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 ) 
    

 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: