list

list -- Assign variables as if they were an array

Description

void list(...);

Like array(), this is not really a function, but a language construct. list() is used to assign a list of variables in one operation.

Example 1. list() example

  1 
  2 <table>
  3  <tr>
  4   <th>Employee name</th>
  5   <th>Salary</th>
  6  </tr>
  7 
  8 <?php
  9 
 10 $result = mysql($conn, "SELECT id, name, salary FROM employees");
 11 while (list($id, $name, $salary) = mysql_fetch_row($result)) {
 12     print(" <tr>\n".
 13           "  <td><a href=\"info.php3?id=$id\">$name</a></td>\n".
 14           "  <td>$salary</td>\n".
 15           " </tr>\n");
 16 }
 17 
 18 ?>
 19 
 20 </table>
 21       

See also: each(), array().