PHP数组语法:array(...)或[...] [英] PHP array syntax: array(...) or [...]
本文介绍了PHP数组语法:array(...)或[...]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在PHP中,这些相同吗? $x = [1,2,3];
和$x = array(1,2,3);
In PHP, are these identical? $x = [1,2,3];
and $x = array(1,2,3);
这两种创建数组的方法是否不同?
Are there cases where these two methods of creating an array differ?
有什么理由要使用另一种吗?
Is there any reason to use one over the other?
推荐答案
它们与$x = [1,2,3];
需要PHP> = 5.4.0的警告相同.
They are identical with the caveat that $x = [1,2,3];
requires PHP >= 5.4.0.
这篇关于PHP数组语法:array(...)或[...]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文