[doc-en] master: Explain $count-- and show output in static variables example (#6012)

From: Date: Sat, 24 Oct 2026 05:56:33 +0000
Subject: [doc-en] master: Explain $count-- and show output in static variables example (#6012)
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-23883@lists.php.net to get a copy of this message
Author: Harshana Jayarathna (harshanajayarathna) Committer: GitHub (web-flow) Pusher: lacatoire Date: 2026-10-24T07:56:30+02:00 Commit: https://github.com/php/doc-en/commit/cc96728a01c9429c0e4cf06c746ec26385ca4e7e Raw diff: https://github.com/php/doc-en/commit/cc96728a01c9429c0e4cf06c746ec26385ca4e7e.diff Explain $count-- and show output in static variables example (#6012) Fixes #2671 Changed paths: M language/variables.xml Diff: diff --git a/language/variables.xml b/language/variables.xml index 95d21540ef85..f450661b414a 100644 --- a/language/variables.xml +++ b/language/variables.xml @@ -535,12 +535,29 @@ function test() if ($count < 10) { test(); } + // Undo the increment, so $count is back to 0 once test() has finished + // and a later call to test() counts from 1 again $count--; } test(); ]]> </programlisting> + &example.outputs; + <screen> +<![CDATA[ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +]]> + </screen> </example> </para>

« previous php.doc.cvs (#23883) next »