Re: php5 call by refference

From: Date: Mon, 21 Nov 2005 10:51:25 +0000
Subject: Re: php5 call by refference
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-226185@lists.php.net to get a copy of this message
On 21 Nov 2005, at 09:26, Georgi Ivanov wrote:
AFAIK, in PHP5 one can't call function with function parameters . The error is that you only can pass variables by reference. foo(strlen('aaa'),strlen('bbbb'));
You can call functions like that without problems UNLESS the function is expecting values by reference, i.e. results are passed back through the parameters. If you supply a function result, then you may as well not be calling the function as you'll never be able to get a result back from it, hence the error message. e.g. function foo(&$a, $b) { $a = $a.$b; } If you call this as you asked, where would the result go?
Is there some sort of workaround ?
As was suggested, put your values in variables before calling the function, though the code example you posted suggests you're trying to do something odd. Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture marcus@synchromedia.co.uk | http://www.synchromedia.co.uk

« previous php.general (#226185) next »