On Thu, 27 Apr 2006 17:24:55 -0400, in php.internals
[EMAIL PROTECTED] (Rasmus Lerdorf) wrote:

>It also tends to be a bug.  Most functions that take an argument by 
>reference do so for a reason.  There are of course exceptions to this as 
>you have pointed out and in those cases assuming your code will never 
>run under PHP 4.3.x it can be valid.  I would still say it is a better 
>idea to something like:
>
>   func_taking_reference($quiet=some_func());  // throw away ref mod
>
>and document the fact that you are intentionally throwing away the 
>reference modification that func_taking_reference is making.  That way 
>you avoid the E_STRICT and make it very clear what you are doing.

It seems like a lot of these problems showed up because people used
array_shift(), array_pop() or other such functions as a shortcut of
retrieving an element returned from a function.

I agree with the changes, but it still seems like people (mis)use
these functions because of lack of array operators (e.g.
array(2,4,3)[1] ).

I don't know if I would go that far to state that there is a demand
for such operators (and the discussion has been going on here before).
But if there is no (just as) simple way of doing it right users will
do it in a bad way.

-- 
- Peter Brodersen

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

Reply via email to