Search notes:

PHP code snippets: list()

list($foo, $bar, $baz) = $someArray; assigns elements of an array to individual variables.
list(…) (like array(…)) is not a function but rather a language construct.
<html><head><title>list()</title></head>
<body>

  <?php 
   
    $a = array('one', 'two', 'three');

    list ($e1, $e2, $e3) = $a;
    
    print "e1: $e1<br>"; 
    print "e2: $e2<br>"; 
    print "e3: $e3<br>"; 


  ?>

  <p>See also <a href='array.html'>array.html</a>

</body>
</html>
Github repository about-php, path: /list.html

See also

Other PHP snippets

Index