Jump to content

alternative array syntax


Goat

Recommended Posts

This isn't life or death question, but I was wondering if there is quicker way to make arrays than standard:

 

$myArray = array('one'=>1, 'two'=>2);

 

this might not seem like a lot of code but I tend to use arrays a lot (and arrays within arrays). So is there perhaps something shorter? Like in python:

 

// not an actual php code
$myArray = ['one'=>1, 'two'=>2];

 

I know php has an alternate syntax for some things, so maybe there is something for this.

 

regards, Goat

Link to comment
https://forums.phpfreaks.com/topic/183804-alternative-array-syntax/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.