List ()
(PHP 4, PHP 5)
list-Specify variables as if they were an array
Describe
void list (mixed $varname [, mixed $ ...])
Like arrays (), this is not a real function, but a language structure. The list () is used to specify one of the variables in the list of jobs.
Parameters
VarName
A variable.
return value
No return of value.
Instance
Examples of # 1 list () For example
Copy Code code as follows:
<?php
$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
?>
Other reference: Http://www.jb51.net/w3school/php/func_array_list.htm