summaryrefslogtreecommitdiffstats
path: root/debian/perl-framework/t/htdocs/php/func3.php
diff options
context:
space:
mode:
Diffstat (limited to 'debian/perl-framework/t/htdocs/php/func3.php')
-rw-r--r--debian/perl-framework/t/htdocs/php/func3.php89
1 files changed, 89 insertions, 0 deletions
diff --git a/debian/perl-framework/t/htdocs/php/func3.php b/debian/perl-framework/t/htdocs/php/func3.php
new file mode 100644
index 0000000..62cee15
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/php/func3.php
@@ -0,0 +1,89 @@
+<?php
+
+old_function a (
+ echo "hey\n";
+);
+
+function b($i)
+{
+ echo "$i\n";
+}
+
+
+function c($i,$j)
+{
+ echo "Counting from $i to $j\n";
+ for ($k=$i; $k<=$j; $k++) {
+ echo "$k\n";
+ }
+}
+
+a();
+b("blah");
+a();
+b("blah","blah");
+c(7,14);
+
+a();
+
+
+old_function factorial $n (
+ if ($n==0 || $n==1) {
+ return 1;
+ } else {
+ return factorial($n-1)*$n;
+ }
+);
+
+function factorial2($start, $n)
+{
+ if ($n<=$start) {
+ return $start;
+ } else {
+ return factorial2($start,$n-1)*$n;
+ }
+}
+
+
+for ($k=0; $k<10; $k++) {
+ for ($i=0; $i<=10; $i++) {
+ $n=factorial($i);
+ echo "factorial($i) = $n\n";
+ }
+}
+
+
+echo "and now, from a function...\n";
+
+old_function call_fact (
+ echo "(it should break at 5...)\n";
+ for ($i=0; $i<=10; $i++) {
+ if ($i == 5) break;
+ $n=factorial($i);
+ echo "factorial($i) = $n\n";
+ }
+);
+
+old_function return4 ( return 4; );
+old_function return7 ( return 7; );
+
+for ($k=0; $k<10; $k++) {
+ call_fact();
+}
+
+echo "------\n";
+$result = factorial(factorial(3));
+echo "$result\n";
+
+$result=factorial2(return4(),return7());
+echo "$result\n";
+
+old_function andi $i, $j (
+ for ($k=$i ; $k<=$j ; $k++) {
+ if ($k >5) continue;
+ echo "$k\n";
+ }
+);
+
+andi (3,10);
+