A brief analysis of the use of list () function in PHP, phplist_php tutorial

Source: Internet
Author: User

A brief analysis of the use of list () function in PHP, phplist


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.

Articles you may be interested in:

    • PHP 3 ways to iterate through an array list (), each (), and while summary
    • PHP Loop Statement Note (foreach,list)
    • PHP Array Traversal method Daquan (Foreach,list,each)
    • In-depth explanation of the PHP list () function
    • Analysis of each and list usage in PHP

http://www.bkjia.com/PHPjc/1089953.html www.bkjia.com true http://www.bkjia.com/PHPjc/1089953.html techarticle A brief analysis of the list () function usages in PHP, phplist the use of the list () function in PHP is described in this example. Share to everyone for your reference, as follows: the list () function in PHP is used in a single 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.