simple quest on return

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
boggle
Forum Newbie
Posts: 2
Joined: Tue Apr 25, 2006 3:16 am

simple quest on return

Post by boggle »

I'm new to php and this question is probably stupidly simple. :oops:

If you have a bit of code that uses return, like :

Code: Select all

if (test=1)
return TRUE;
else
return FALSE;

How do you check what was returned?

Sorry if this question is a bit daft.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Return is only supposed to be used in functions/methods, so it would be what comes from them. You probably check the results of a function all the time without even knowing it:

Code: Select all

$return = isset($_GET['someVar']);
$return = include('someFile.php');
$return = str_replace('foo', 'bar', boofoo');
boggle
Forum Newbie
Posts: 2
Joined: Tue Apr 25, 2006 3:16 am

Post by boggle »

Thanks :)
Post Reply