PHP list () function usage example analysis, phplist. PHP list () function usage example analysis, phplist this article describes the use of list () function in PHP. For your reference, the list () function in PHP is used to analyze the usage of the list () function in a single PHP operation.
This example describes the usage of the list () function in PHP. We will share this with you for your reference. The details are as follows:
The list () function in PHP is used to assign values to a group of variables in an operation.
Note:: The array variable can only be an array of numeric indexes, and it is assumed that the numeric index starts from 0.
List () function definitionAs follows:
List (var1, var2 ...)
Parameter description:
Var1 is required. The first variable to be assigned a value.
Var2,... optional. More variables to be assigned values.
Sample codeAs follows:
<? Php // $ arr = array ('name' => 'Tom ', 'pwd' => '123'); // error! The index must be a Digital Index! // $ Arr = array ('1' => 'Tom ', '2' => '123'); // error! The number index must start from 0! $ Arr = array ('Tom ', '123'); list ($ name, $ pwd) = $ arr; echo "Welcome". $ name ."! Remember your password: ". $ pwd;?>
I hope this article will help you with PHP programming.
Articles you may be interested in:
- PHP looping through the three methods of array list (), each () and while Summary
- PHP loop statement notes (foreach, list)
- PHP array traversal method (foreach, list, each)
- In-depth explanation of php list () functions
- Analysis of each and list usage in PHP
Example of using the aggregate () function: phplist describes the usage of the list () function in PHP. For your reference, the list () function in PHP is used in one operation...