Home > Backend Development > PHP Tutorial > PHP5.4开始php精简Array数组语法[]

PHP5.4开始php精简Array数组语法[]

WBOY
Release: 2016-06-20 13:02:40
Original
1116 people have browsed it

PHP 5.4开始php精简Array数组语法

PHP 5.4为您奉上精简的array数组语法:

$fruits = array('apples', 'oranges', 'bananas'); // "old" way
// 学Javascript的数组了
$fruits = ['apples', 'oranges', 'bananas'];
// 关联数组
$array = [
    'foo' => 'bar',
    'bar' => 'foo'
];
Copy after login

当然,旧语法依旧有效,我们多了一种选择。


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