Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
PHP の配列の短いタグについて知りました。
私のコードでは、次を使用します:
$arr = array(); // do something
今私は使用することができます:
$arr = []
では、PHP で array() より [] を使用する利点は何でしょうか?
[]と の間に違いはありませんarray()。これらの両方の宣言は、文字通り配列宣言自体として呼び出されます。arrayここでの利点は、(2)のように入力できる一方で、(5)を入力する時間を節約できることです[]。
[]
array()
array