hello Rasmus,

sorry to interrupt ... but ... could you possibly
spare a moment to explain why the SquirrelMail example you gave
is 'dumb' code? (I for one would like to avoid writing dumb code
wherever possible, and it looks a lot like I line I could have written!)

many thanks and regards,
jochem

Rasmus Lerdorf wrote:

...


SquirrelMail has code like this all over the place:

   $value = strtolower(array_shift(split('/\w/',trim($value))));

Here array_shift() does of course change the arg, so that is a potential
problem.  And yes, that's a dumb way to do this, but people write code
like this.  In some of these array manipulation calls, which seems to
account for a number of the BC problems we are having, we could check
for a non-ref and behave slightly differently.  In the case of
array_shift() we could return the first arg and throw a notice.  Same
would go for reset(), end(), next(), prev() and probably a few others.

-Rasmus


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to