list()
(PHP 4, PHP 5)
list - specifies variables as if they were an array
Description
void list ( mixed $varname [, mixed $... ] )
Like array(), this is not really a function, but a language construct . list() is used to specify one of the variables in the list job.
Parameters
varname
A variable.
Return Value
Return without value.
Example
Example #1 list( )
Copy code The code is as follows:
$info = array('coffee', 'brown', 'caffeine');
// Listing all the variables
list($drink , $color, $power) = $info;
echo "$drink is $color and $power makes it special.n";
// Listing some of them
list($drink, , $ power) = $info;
echo "$drink has $power.n";
// Or let's skip to only the third one
list( , , $power) = $info;
echo "I need $power!n";
// list() doesn't work with strings
list($bar) = "abcde";
var_dump($bar); // NULL
?>
Also reference: http://www.jb51.net/w3school/php/func_array_list.htm
http://www.bkjia.com/PHPjc/327315.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327315.htmlTechArticlelist() (PHP 4, PHP 5) list-specifies variables as if they were an array description void list ( mixed $varname [, mixed $... ] ) like array( ) , which is not a real...