Home > php教程 > php手册 > body text

PHP中list()函数用法实例简析,phplist

WBOY
Release: 2016-06-13 08:47:55
Original
1389 people have browsed it

PHP中list()函数用法实例简析,phplist

本文实例讲述了PHP中list()函数用法。分享给大家供大家参考,具体如下:

PHP中的list() 函数用于在一次操作中给一组变量赋值。

注意这里的数组变量只能为数字索引的数组,且假定数字索引从 0 开始

list()函数定义如下:

list(var1,var2...)

参数说明

var1      必需。第一个需要赋值的变量。
var2,...  可选。更多需要赋值的变量。

示例代码如下:

<&#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

希望本文所述对大家PHP程序设计有所帮助。

您可能感兴趣的文章:

  • PHP循环遍历数组的3种方法list()、each()和while总结
  • PHP循环语句笔记(foreach,list)
  • PHP 数组遍历方法大全(foreach,list,each)
  • 深入php list()函数的详解
  • PHP中each与list用法分析
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 Recommendations
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!