Re: Question to example from manual

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* janbro <janbro@xxxxxx>:
> Hi, I've been working on this example and copied it in my
> webroot, it doesn't give me an output. Does anybody know why?
> "System" WinXP  Apache 2.0.50 php 5.0.3
> 
> Example 7-6. Static variables with recursive functions
>
> <?php
> function Test()
> {
>     static $count = 0;
>
>     $count++;
>     echo $count;
>     if ($count < 10) {
>         Test ();
>     }
>     $count--;
> }
> ?>

You need to call the function. Place the following line after or before
the function declaration:

    Test();

I tested it, and it works fine.

-- 
Matthew Weier O'Phinney           | WEBSITES:
Webmaster and IT Specialist       | http://www.garden.org
National Gardening Association    | http://www.kidsgardening.com
802-863-5251 x156                 | http://nationalgardenmonth.org
mailto:matthew@xxxxxxxxxx         | http://vermontbotanical.org

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux