A simple example of PHP looping a one-dimensional array, first convert the string into an array according to certain rules, and then traverse the output. It is actually a very simple method
A simple PHP An example of looping a one-dimensional array is to first convert the string into an array according to certain rules, and then traverse the output. It is actually a very simple method, because a two-dimensional array structure diagram I recently made was a headache, so I can't remember how to perform traversal output for a while. The simple example code is as follows:
foreach traverses the array
$value) { echo $key.'='.$value.'
'; } ?>
Traverses the associative array
'Lilia','Gender'=>'female','Age'=>'23','School'=>'Peking University'); foreach ($userList as $key => $value) { echo $key.'='.$value.'
'; } ?>
The above is the entire content of this article, I hope it will be helpful to everyone's study.
Related recommendations:
How to automatically load classes in PHP
PHPTwo-dimensional array deduplication or statistics based on a certain field
The above is the detailed content of PHP one-dimensional array loop traversal implementation method. For more information, please follow other related articles on the PHP Chinese website!