欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  php教程

PHP list() 函数

程序员文章站 2022-06-01 17:11:41
...
$my_array = array("Dog","Cat","Horse");

list($a, $b, $c) = $my_array;
echo "I have several animals, a $a, a $b and a $c.";
?>
输出:

I have several animals, a Dog, a Cat and a Horse.
例子 2
$my_array = array("Dog","Cat","Horse");

list($a, , $c) = $my_array;
echo "Here I only use the $a and $c variables.";
?>
输出:

Here I only use the Dog and Horse variables.