Another option is to use an array to return the values you want to be
returned, of course this will not be in the same manner as system() does, but
can sometimes be a smother way to return multiple values.
Re: Make a function that returns more than one value?
"The87Boy" <the87boy@gmail .comwrote in message
news:1159199042 .142987.271750@ i3g2000cwc.goog legroups.com...
Is there any ways to make a function like system(), which returns more
than one value (true or false) and (the array)
>
It is something I've done many times in c++ but not so much in PHP...
that one thing returned could be an object which has whatever you want in
it.
here is the relevant line from the docs
function demo($bl,$ar) {
$c = new stuff($bl,$ar);
return $c;
}
$d = demo(true,$arr) ;
echo "<br/><br/>d->bool returned from demo is ".$d->get_bool();
$da = $d->get_array();
echo "<br/>d->a[0] returned from demo is ".$da[0];
echo "<br/>d->a[1] returned from demo is ".$da[1];
echo "<br/>d->a[2] returned from demo is ".$da[2];
Comment