RE: [PHP] Tidying code for PHP5.0.5/PHP4.4.0

From: Date: Tue, 20 Sep 2005 16:25:23 +0000
Subject: RE: [PHP] Tidying code for PHP5.0.5/PHP4.4.0
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-222793@lists.php.net to get a copy of this message
Rasmus Lerdorf wrote: > Michael Sims wrote: >> When used as an expression, an assignment evaluates to whatever is >> on the right side of the assignment operator, not the left. >> Example: [...] >> foo($a = 5); >> and >> foo(5); >> >> are exactly the same... > > The value passed is the same, but when passed as $a=5 then the value > has a symbol table entry associated with it whereas if you just pass > in 5 it doesn't. That means that: > > function foo(&$arg) { $arg =6; } > > will work if you call: foo($a=5); > but you will get an error if you have: foo(5); Oops, sorry for posting misinformation, I was not aware of the above... Thanks for the info.

« previous php.general (#222793) next »