Home > Backend Development > PHP Tutorial > 深入php list()函数的详解_php技巧

深入php list()函数的详解_php技巧

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-17 09:03:32
Original
1095 people have browsed it

list()
( PHP 4中, PHP 5中)
list-指定变量,好象他们是一个数组
描述
void list ( mixed $varname [, mixed $... ] )
像阵列( ) ,这是不是一个真正的功能,而是一种语言结构。名单( )是用来指定名单中的变数之一作业。
参数
varname
一个变量。
返回值
没有价值的返回。
实例
例如# 1名单( )的例子

复制代码 代码如下:

$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
?>

另外参考:http://www.jb51.net/w3school/php/func_array_list.htm
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template