note 35250 added to function.return
| From: | patrik dot germann at gmx dot net | Date: | Mon, 25 Aug 2003 14:38:03 +0000 |
| Subject: | note 35250 added to function.return | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-55038@lists.php.net to get a copy of this message | ||
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));
----
Manual Page -- http://www.php.net/manual/en/function.return.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35250
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35250&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35250&report=yes