On Mon, June 11, 2012 2:13 pm, Stas Malyshev wrote:
>> And then one would expect some rather complex logic to compute -N
>> for
>> $var[-N]
>
> I don't see much of complex logic here, but $a[2] = 'a' would create a
> new array element if it does not exist, while $a[-2] can't. Not a big
> issue, but somewhat inconsistent I guess.

$n = some_incredibly_long_and_complex_computation();
//and, for real fun, sometimes it returns positive, and sometimes
negative.

$s = $var[$n];

//a few hundred lines later, buried somewhere else

if ($n < 0){
//whatever
}
else{
//something entirely different
}

Sooner or later, somebody will do that, and I really don't want to
have to un-tangle all that mess to figure out if $n is positive or
negative for the sake of saving a few keystrokes...

-- 
brain cancer update:
http://richardlynch.blogspot.com/search/label/brain%20tumor
Donate:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FS9NLTNEEKWBE



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

Reply via email to