by rorrr · 15y ago · 0 comments
$bar = [1, 2, 3];
$foo = {
'bar': TRUE,
'baz': 'socks'
}; array(1, 'bar' => TRUE, 3, 'baz' => 'socks');
But I do like this syntax idea.$foo = { bar: TRUE, baz: 'socks' };
where keys are unquoted. The less typing the better.
$keyName = "bar"; $array = array($keyName => "baz");
So in that instance it makes sense to force people to quote their keys. Also, bar or baz could be constants.
I know some browsers allow it, but it's not true JSON.