Re: Multi dimensional array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3-8-2015 7:22, Ashley Sheridan wrote:
The main thing I think you missed was that array constructs use () and
not [] in their creation, which you were using in both of your arrays,
that way is a little more how Javascript does it.

That was actually changed in PHP 5.4. There are now 2 ways of creating a new array;
- using array()
- using [] (which is just a shortcut)

So basically
$foo = array('a'=>1, 'b'=>2);
is equivalent to
$foo = ['a'=>1, 'b'=>2];

More info: http://php.net/manual/en/language.types.array.php#language.types.array.syntax

- Tul


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux