Thanks ! It's all clear now . :) On Monday 21 November 2005 14:45, Oliver Grätz wrote: > Georgi Ivanov schrieb: > > Hi, > > 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')); > > > > Is there some sort of workaround ? > > First of all, the problem with this arises if your function foo is > defined as > > function foo(&$a,&$b) { ... } > > There is no problem if a and b are not reference parameters. > So think a second about this: You tell in the definition of foo that you > want to write to the position where a and b are stored. But by calling > the funtion with strlen() you don't have a position in user space > because the results of strlen() are just values which haven't been > explicitly stored. > > Now you can decide if you don't write to your parameters a and b. Then > there is no need for call by reference! It is not true that PHP copies > the value and that you save memory by using references! The values of > call-by-value parameters are copied if and only if you WRITE to them! > The Zend Engine 2 is highly optimized for this. > > If you want to write to a and/or b then you must supply a storage > container (also called variable *g*). Simplest way of supplying a > temporary container: > > foo($t1=strlen('aaa'),$t2=strlen('bbbb')); > > Have Fun! > OLLi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php