I agree with this. So the idea would be adding short hand object notation for
PHP, inspired by JSON, but we also allow for associative arrays. So:
$object = { 'var1': 'one', 'var2': 'two' }; // for an object
$assoc_array = [ 'var1': 'one', 'var2': 'two' ]; // for an array
// even mix and match
$person = {
'name': 'Justin',
'city': 'Ogden'
'phones' : [
'home': '555-3928',
'work': '555-3922'
]
};
echo $person->phones['home']; // output: 555-3928
The other option is the [] shorthand would create an ArrayObject, so you can
interact with the object like an array or object. But I think it is important
that we make it possible to allow for array AND object shorthand.
Justin
On May 31, 2011, at 3:56 PM, dukeofgaming wrote:
> Guys, as I said earlier, not even javascript (from javascript object
> notation, as in JSON) is 100% interoperable with JSON because single quotes
> are valid in javascript and not in json. I say ":" is way more cleaner than
> "=>" and it is a good opportunity to adopt it.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php