Home  >  Article  >  Backend Development  >  PHP-array

PHP-array

不言
不言Original
2018-04-13 09:17:401273browse

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!

Statement:
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