Jump to content

multiple Return values


CBG

Recommended Posts

Hi,

 

I have a function with the below code in it and I want to have multiple Return values and am unsure how to do it

 

if ( $one == 'yes') {
echo 'One Appear';
} else {
echo 'One Does not Appear<br>';		
$one_bot = 0;
}

if ( $two == 'yes') {
echo 'Two Appear';
} else {
echo 'Two Does not Appear<br>';		
$two_bot = 0;
}

if ( $three == 'yes') {
echo 'Three Appear';
} else {
echo 'Three Does not Appear<br>';		
$three_bot = 0;
}

 

Now if I put the below it returns 1 0 (zero) in the browser and not all 3

return $one_bot;
return $two_bot;
return $three_bot;

 

So it seems to be it not working like that, so should I put it in an array like

 

$list = array($one_bot, $two_bot, $three_bot);
return $list;

 

?

 

If not how should I do it?

Link to comment
https://forums.phpfreaks.com/topic/197903-multiple-return-values/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.