note 35250 deleted from function.return by vincent
| From: | vincent@php.net | Date: | Mon, 25 Aug 2003 16:39:17 +0000 |
| Subject: | note 35250 deleted from function.return by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-55045@lists.php.net to get a copy of this message | ||
Note Submitter: patrik.germann@gmx.net
----
To use return recursively from within a function, use this syntax:
return (functionName(arguments));
example:
function showArray($array)
{
if (is_array($array) && count($array)>0)
{
$temp=array_splice($array,0,1);
echo $temp[0].'\r\n';
return (showArray($array));
}
}
$fooba=array('apple','pear','banana','mango','milkshake','miner');
showArray($fooba);
if above code-block was a function within a class the syntax would be
return ($this->showArray($foobar));