summaryrefslogtreecommitdiff
path: root/tests/recurse
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>1999-07-08 21:56:19 +0000
committerAndrey Hristov <andrey@php.net>1999-07-08 21:56:19 +0000
commit743935ca8eb0c43bd67bf0cd29fd3e70ce494f94 (patch)
tree1da929407eda2a5fe09b5c1e7f1b16dae9db5309 /tests/recurse
parentcef4df1fee046105ab35f47c152d39bf16a55a07 (diff)
downloadphp-git-743935ca8eb0c43bd67bf0cd29fd3e70ce494f94.tar.gz
More cleanup.
Diffstat (limited to 'tests/recurse')
-rw-r--r--tests/recurse21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/recurse b/tests/recurse
new file mode 100644
index 0000000000..026394a9f4
--- /dev/null
+++ b/tests/recurse
@@ -0,0 +1,21 @@
+<?
+
+function factorial($n)
+{
+ if ($n==0 || $n==1) {
+ return 1;
+ } else {
+ return $n*factorial($n-1);
+ }
+}
+
+
+for ($k=0; $k<10; $k++):
+for ($i=0,$sum=0; $i<150; $i++) {
+ $sum = $sum+factorial($i);
+}
+endfor;
+
+print "\$sum=$sum\n";
+
+