PHP-array

不言
Release: 2023-03-23 16:20:01
Original
1275 people have browsed it

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'=>'香蕉');
Copy after login

Access index array:

$fruit=array("苹果","香蕉");
foreach($fruit as $key=>$value){ echo ...}
Copy after login

Creation of associative array:

$fruit = array('apple'=>'苹果','banana'=>'香蕉');
foreach ($fruit as $key=>$value){echo...}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template