|
Posted by "Michael Sims" on 09/20/05 19:25
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.
Navigation:
[Reply to this message]
|