List ()
(PHP 4 and PHP 5)
List-specify variables as if they are an array
Description
Void list (mixed $ varname [, mixed $...])
Like arrays (), this is not a real function, but a language structure. A list () is a job used to specify a variable in the list.
Parameters
Varname
A variable.
Return Value
Returns without value.
Instance
Example of #1 List ()
Code
<? 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
?>
Additional reference: http://www.w3school.com.cn/php/func_array_list.asp