note 103496 added to language.variables.scope
| From: | israel_rider at osu1 dot php dot net | Date: | Fri, 15 Apr 2011 18:19:59 +0000 |
| Subject: | note 103496 added to language.variables.scope | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-178895@lists.php.net to get a copy of this message | ||
<?php
// Improved "Example #6 Static variables with recursive functions"
function print_it($count)
{
printf('%'.($count * 5).'d'.PHP_EOL, $count);
}
function test()
{
static $count = 0;
//
$count++;
print_it($count);
if ($count < 10)
{
test();
}
//
$count--;
print_it($count);
}
header('Content-type: text/plain');
test();
----
Server IP: 69.147.83.197
Probable Submitter: 2.54.45.180
----
Manual Page -- http://www.php.net/manual/en/language.variables.scope.php
Edit -- https://master.php.net/note/edit/103496
Del: integrated -- https://master.php.net/note/delete/103496/integrated
Del: useless -- https://master.php.net/note/delete/103496/useless
Del: bad code -- https://master.php.net/note/delete/103496/bad+code
Del: spam -- https://master.php.net/note/delete/103496/spam
Del: non-english -- https://master.php.net/note/delete/103496/non-english
Del: in docs -- https://master.php.net/note/delete/103496/in+docs
Del: other reasons-- https://master.php.net/note/delete/103496
Reject -- https://master.php.net/note/reject/103496
Search -- https://master.php.net/manage/user-notes.php