Brief analysis of usage examples of list() function in PHP, phplist_PHP tutorial

WBOY
Release: 2016-07-12 09:01:08
Original
832 people have browsed it

A brief analysis of examples of list() function usage in PHP, phplist

This article describes the usage of list() function in PHP with examples. Share it with everyone for your reference, the details are as follows:

The list() function in PHP is used to assign values ​​to a set of variables in one operation.

Note: The array variable here can only be a numerically indexed array, and it is assumed that the numerical index starts from 0.

list() function definition is as follows:

list(var1,var2...)

Parameter Description:

var1 Required. The first variable to be assigned a value.
var2,... Optional. More variables need to be assigned values.

Sample code is as follows:

<&#63;php
 //$arr=array('name'=>'Tom','pwd'=>'123456'); //错误!索引必须为数字索引!
 //$arr=array('1'=>'Tom','2'=>'123456'); //错误!数字索引必须从0开始!
 $arr=array('Tom','123456');
 list($name,$pwd)=$arr;
 echo "Welcome ".$name." ! Remember your password:".$pwd;
&#63;>

Copy after login

I hope this article will be helpful to everyone in PHP programming.

Articles you may be interested in:

  • 3 ways to loop through arrays in PHP: list(), each() and while summary
  • PHP loop statement notes (foreach, list)
  • Comprehensive list of PHP array traversal methods (foreach, list,each)
  • In-depth explanation of the PHP list() function
  • Analysis of the usage of each and list in PHP

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1089953.htmlTechArticleA brief analysis of examples of list() function usage in PHP, phplist This article explains the usage of list() function in PHP. Share it with everyone for your reference, the details are as follows: The list() function in PHP is used to operate in one operation...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!