On Monday, April 1, 2002, at 02:13 PM, Jordan K. Martin wrote:
> Makes sense. I didn't think much when writing that piece...but...what
> is
> the & for? wouldn't it work the same without it?
>
> function test ($var)
> {
> $var = addslashes($var)
> }
>
> $foo = "He's dreaming";
> test($foo);
> print($foo);
No, this won't work because you're not returning a value. You need to
either have a return statement in this function that says "return $var;"
or you need to use the & sign, which lets you change the value of a
variable outside the namespace of the function. Or scope. I forget
which it is.
Try your above code -- it shouldn't work.
Erik
----
Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php