Yasuo Ohgaki wrote:

> In languages, there are literal, constant and variable. Return value is
> variable.
> It's better to keep basic rule. IMHO.
> 
> $top = array_pop(f2());
> 
> is better than
> 
> $v = f2();
> $top = array_pop($v);
> 
> Is there anyone who likes latter?
> Are there any other languages behave like PHP?

IMHO, the first snippet is confusing (the second as well, if $v is not
used in the following code).  Actually, you don't want to pop the top of
the stack, but you want to simply get it without altering the stack at
all.  Therefore it seems reasonable to use a function called array_top()
(or so) which takes its argument by value.

-- 
Christoph M. Becker

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

Reply via email to