Re: [PHP4BETA] recursive functions?
| From: | Michael Stearne | Date: | Wed, 03 May 2000 00:06:30 +0000 |
| Subject: | Re: [PHP4BETA] recursive functions? | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-14397@lists.php.net to get a copy of this message | ||
That's not recursive anyway. A recursive function calls itself.
Michael
Gernot Schabkar wrote:
> is it somehow possible to realize a recursive program like that with php?
>
> <?
> function print1($txt) {
> if ($txt!="") {
> echo substr($txt,0,1);
> print2(substr($txt,1));
> }
> }
> function print2($txt) {
> if ($txt!="") {
> echo substr($txt,0,1);
> print1(substr($txt,1));
> }
> }
> print2("test");
> ?>
>
> that should produce :
> test
>
> if there is a trick to manage it, then a hint would be very welcome!
>
> --
> PHP 4.0 Beta Mailing List <http://www.php.net/version4/>
> To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net
> For additional commands, e-mail: php4beta-help@lists.php.net
> To contact the list administrators, e-mail: php4beta-admin@lists.php.net