Leigh Makewell wrote:
> a perfectly legal statement like this $x = current(explode(' ','a b'));

In this particular case, current() did not need to take a reference
since it doesn't modify anything.  This has been fixed in CVS.  That's
still not how I'd write that though.  I would write:

  list($x) = explode(' ','a b');

Another way to write this:

  $x = array_shift(explode(' ','a b'));

This is where it gets tricky.  Is this legal code?  We are modifying the
argument and immediately discarding the modification.  The user might
want to know about that, so to me it makes sense that this throws a
NOTICE.  I do agree with folks who don't like this being a fatal error.
 I don't think it should be either and this is what we have been
discussing.  That doesn't change the fact that a lot of these examples
are not optimal coding examples.  There are usually more direct ways
that doesn't involve a useless operation that ends up getting discarded
right away.  So while the tone of some of these messages may not be
great, often the suggestion that the code in question isn't very good is
 accurate.

-Rasmus

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

Reply via email to