Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do square brackets mean in PHP? [duplicate]

Tags:

php

I am new to PHP and have read a tutorial where I did not understand something in the code:

What does it mean when $names = []; is in a PHP script?

like image 505
Shoruna Avatar asked Dec 11 '25 01:12

Shoruna


1 Answers

Its the same as array(). This syntax is valid since PHP 5.4.

$array = [1, 2, 3, 4];
like image 148
Havenard Avatar answered Dec 13 '25 14:12

Havenard



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!