To add to the conversation ...
You created a function to pass something through it, to process something and
now you want to get something back, right? That's what return does. It gets
something back for your effort.
You could simply:
But let's say you do it a hundred times in the course of a script. You don't
want to take up a hundred lines of code doing:
... so you create a function like Eric has below, which takes up 3 or 4 lines of
code, but has the capacity to repeat the same line of code 100 times.
> The purpose of return, is to "return" a value..
> function test($var)
> return addslashes($var);
> $foo = "Yes, I'am Very Awsome";
> $foo = test($foo);
> // echo's, Yes I\'am Very Awsome
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php