list()
( PHP 4中, PHP 5中) list-指定变量,好象他们是一个数组
void list ( mixed $varname [,mixed $... ] )
像阵列( ) ,这是不是一个真正的功能,而是一种语言结构。名单( )是用来指定名单中的变数之一作业。
varname
一个变量。
返回值
没有价值的返回。
例如# 1名单( )的例子
代码如下:
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
?>
$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
?>
另外参考://www.jb51.cc/w3school/php/func_array_list.htm 原文链接:https://www.f2er.com/php/26457.html