英[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:
Parameters | Description |
var1 | Required. 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中文网有 $a 和 $c 两位老师。"; ?>
Run instance»
Click the "Run instance" button to view the online instance
Output:
php中文网有 西门 和 无忌 两位老师。
<?php $my_array = array("西门","灭绝","无忌"); list($a,$b,$c) = $my_array; echo $a.','.$b.'和'.$c.'是php中文网的三位老师。'; ?>
Run Instance»
Click the "Run Instance" button to view the online instance
Output:
西门,灭绝和无忌是php中文网的三位老师。