4 ms·
For being JSONish it should be $foo = { bar: TRUE, baz: 'socks' }; where keys are unquoted. The less typing the better.
by z92 15y ago
For being JSONish it should be
$foo = {
bar: TRUE,
baz: 'socks'
};
where keys are unquoted. The less typing the better.
- swivelmaster 15y agoHowever, PHP allows me to do this: $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.
- rorrr 15y agoThat's against the spec. json_decode() will not even decode this. http://www.json.org/ http://www.json.org/ I know some browsers allow it, but it's not true JSON.