PHP list () function usage example analysis, phplist_PHP tutorial

Source: Internet
Author: User
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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.