文章总结一下关于PHP each()与list()函数 有需要的朋友可参考一下。
void list ( mixed varname, mixed … )
注: list() 仅能用于数字索引的数组并假定数字索引从 0 开始
例子
代码如下 | 复制代码 |
$info = array('coffee', 'brown', 'caffeine'); // Listing all the variables // Listing some of them // Or let's skip to only the third one // list() doesn't work with strings |
each() 函数生成一个由数组当前内部指针所指向的元素的键名和键值组成的数组,并把内部指针向前移动。
array each ( array &array )
返回 array 数组中当前指针位置的键/值对并向前移动数组指针。键值对被返回为四个单元的数组,键名为 0,1,key 和 value。单元 0 和 key 包含有数组单元的键名,1 和 value 包含有数据。
代码如下 | 复制代码 |
|
each() 经常和 list() 结合使用来遍历数组,
例如:
代码如下 | 复制代码 |
$cities=array("California"=>array("Martinez","San Francisco","Los Angeles"), |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 English version
Recommended: Win version, supports code prompts!

Atom editor mac version download
The most popular open source editor

Notepad++7.3.1
Easy-to-use and free code editor

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.
