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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.