This example describes the use of list () functions in PHP. Share to everyone for your reference, as follows:
The list () function in PHP is used to assign values to a set of variables in a single operation.
Note: The array variable here can only be an array of numeric indices, and it is assumed that the numeric index starts at 0 .
The list () function is defined as follows:
List (Var1,var2 ...)
Parameter description:
Var1 required. The first variable that needs to be assigned a value.
Var2,... Optional. More variables that need to be assigned.
The sample code is as follows:
<?php//$arr =array (' name ' = ' Tom ', ' pwd ' = ' 123456 '); Error! Index must be a numeric index! $arr =array (' 1 ' = ' Tom ', ' 2 ' = ' 123456 '); Error! The digital index must start at 0! $arr =array (' Tom ', ' 123456 '); List ($name, $pwd) = $arr; echo "Welcome". $name. "! Remember your password: ". $pwd;? >
I hope this article is helpful to you in PHP programming.
The above introduces the list function usage example in PHP, including the aspects of the content, I hope the PHP tutorial interested in a friend helpful.