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

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1740101580, '3.21.104.128', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/web/php/snippets/list/index(63): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78