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

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 105
    Comment on it

    What is the use of list() function?

    The list() function is used to assign values to a list of variables in one operation. list() function basically works on numerical arrays.

    Syntax of list() function:-

    list(variable1,variable2,variable3.....)

    <?php
    //here Student_name is a variable
    $Student_name = array("Joe","Kallis","Roy","Ramon");
    
    // here call the list() and decleare variable
    list($t,$x, $y, $z) = $Student_;name;
    //print the all variable
    echo "All student name is:- a->$t,  b->$x, c->$y, d->$z.";
    ?>
    

    Output will come like this:

    All student name is:

    a->Joe,

    b->Kallis,

    c->Roy,

    d->Ramon

 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: