The list function in PHP traverses the array?
How to use the list function: list(mixed$ variable 1[, mixed $variablen]), has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
1. How to use the list function list (mixed$ variable 1[, mixed $ variable n]), the code is as follows
<?php list($one,$two,$three)=array('張三','李四','王五'); //再次聲明:單引號不解釋變量,所以輸出的是字符串$one// echo $one; echo '$two...'.$two.'<br/>'; echo '$three...'.$three.'<br/>'; ?>
It can be seen that the function of list is: the corresponding variable with subscript 0 in the cited array is 1, the corresponding variable with subscript 1 is 2, and so on.
Conclusion:
1: Assign Zhang San with subscript 0 to $one
2: Assign Li with subscript 1 Four is assigned to $two
3: Zhang San with subscript 2 is assigned to $three
. Finally, we get that the function of list is from left to right, --corresponding to the index array Subscript starting from 0;
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of PHPlist, each function traverses arrays (source code attached). For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

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

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

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

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

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)