2008/5/28 Stan Vassilev | FM <[EMAIL PROTECTED]>:
> var array = new Array();  -- same as -- var array = [];
> var object = new Object(); -- same as -- var object = {};
>
> And when people have both of those, guess which one they use in more than
> 90% of the cases.
>
> Regards,
> Stan Vassilev

I've moved from PHP to JS and I found this confusing. I don't any
more, but I was used to saying I wanted an array by using the Array
keyword (makes sense - no shortcut - no confusion).

I still say Array() and Object() as they explicitly declare my
intentions and others that would find [] and {} confusing (at least
initially) don't have to struggle with my code.

[] is fine for accessing an array. That's very common in many languages.
{} was confusing as that is that is used to wrap a function's code.

I don't see any real benefit in using $a = [] over $a = array()

So, for a userland developer (rather than a core developer) -1.


-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to