In javascript you can easily create objects and Arrays like so:
var aObject = { foo:'bla', bar:2 }; var anArray = ['foo', 'bar', 2]; Are similar things possible in PHP?
I know that you can easily create an array using the array function, that hardly is more work then the javascript syntax, but is there a similar syntax for creating objects? Or should I just use associative arrays?
$anArray = array('foo', 'bar', 2); $anObjectLikeAssociativeArray = array('foo'=>'bla', 'bar'=>2); So to summarize:
Does PHP have javascript like object creation or should I just use associative arrays?
var_export($var)returns what I needed, even if it's not the most compact form. So this may be off-topic, sorry, but in case it's useful to someone... I'm leaving this comment. Feel free to tell me or downgrade me or ask me to delete this if it's a bad comment.