Jump to content

building a function with multiple outputs


monkeytooth

Recommended Posts

I want to build a function that has multiple outputs.

 

I know but am not to sure how I should go about that, the only thing I know won't work is

return a;

return b;

return c;

 

that will return one result at best. what I need to do is output a b and c from the same function, but I am looking for ideas on how to do that.

If you know you function is returning an array, just like you have indicated, then you can decide how to handle it, either by picking elements you need, or by unpacking it with implode, or by using foreach to do something with each element.

 

Basically it depends what you have put into the array, and what you want to do with each element, and of course you will know what is in there, since it is your function

 

 

Then i just explode it or call it out in a foreach or something. Ok, that makes more sense to me now, In my head I was dragging it out in ways that didn't make a lick of sense nor would they work.

 

Thanks for your help and your patients

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.