英[l?st] 美[l?st]

n. List, catalog; slant; edge of cloth, head of cloth; narrow strip

vt. List, include; organize... Table; put in the list

vi.Listed on the table

Third person singular: lists Plural: lists Present participle: listing Past tense: listed Past participle: listed

php list() function syntax

Function: Used to assign values ??to a group of variables in one operation.

Syntax: list(var1,var2...)

Parameters:

ParametersDescription
var1Required. The first variable to be assigned a value.
var2,...Optional. More variables need to be assigned values.

Note: Use elements in the array to assign values ??to a set of variables. list() is actually a language structure, not a function.

php list() function example

<?php
$my_array = array("西門","滅絕","無忌");
list($a, , $c) = $my_array;
echo "php中文網(wǎng)有 $a 和 $c 兩位老師。";
?>

Run instance?

Click the "Run instance" button to view the online instance

Output:

php中文網(wǎng)有 西門 和 無忌 兩位老師。


<?php
$my_array = array("西門","滅絕","無忌");
list($a,$b,$c) = $my_array;
echo $a.','.$b.'和'.$c.'是php中文網(wǎng)的三位老師。';
?>

Run Instance?

Click the "Run Instance" button to view the online instance

Output:

西門,滅絕和無忌是php中文網(wǎng)的三位老師。