Home > Article > Backend Development > PHP-array
This article introduces some knowledge about PHP arrays. Now I share it with you. Friends in need can refer to it
There are three ways to create index arrays:
$fruit=array("香蕉"); $fruit=array();$fruit[0]="香蕉"; $fruit=array('0'=>'香蕉');
Access index array:
$fruit=array("苹果","香蕉"); foreach($fruit as $key=>$value){ echo ...}
Creation of associative array:
$fruit = array('apple'=>'苹果','banana'=>'香蕉'); foreach ($fruit as $key=>$value){echo...}
Related recommendations:
How to deal with PHP array problems
Detailed explanation of the use of PHP array access interface ArrayAccess
Several methods of converting mysql query results into PHP arrays
The above is the detailed content of PHP-array. For more information, please follow other related articles on the PHP Chinese website!