function c($param1) { if ($param1 > 5) { $p = put_string("funkcia c() vola funkciu a()\n"); $p = a($param1 - 1); } else { return 0; } }
function increment_to_milion($x) { if ($x === 0) { $t = put_string("Done\n", $x); return 0; } else { $t = increment_to_milion($x - 1); } }
function MyMain($str) { $str1 = $str; $str2 = $str1 . ", ktery jeste trochu obohatime"; $x = put_string($str1, "\n", $str2, "\n"); $p = find_string($str2, "text"); $x = put_string("Pozice retezce \"text\" v \$str2: ", $p, "\n"); $x = put_string("Zadejte posloupnost vsech malych pismen a-h, "); $x = put_string("aby se pismena v posloupnosti neopakovala:\n"); $str1 = get_string(); $str2 = sort_string($str1); while ($str2 !== "abcdefgh") { $x = put_string("Spatne zadana posloupnost, zkuste znovu:\n"); $str1 = get_string(); $str2 = sort_string($str1); } return 0; }
function printAllPermutations($str, $prefix) { $strLen = strlen($str); if ($strLen === 1) { $res = put_string($prefix, $str, "\n"); } else { $n = 0; while ($n < $strLen) { // We have to check case so that $n != $strLen because of get_substring if ($n < $strLen - 1) { $rest = get_substring($str, 0, $n) . get_substring($str, $n + 1, $strLen); } else { $rest = get_substring($str, 0, $n); } $pref = $prefix . get_substring($str, $n, $n + 1); $res = printAllPermutations($rest, $pref); $n = $n + 1; } } }
function g() { $x = put_string("g()\n"); $c = $x / 5; }
if ($x !== 0) { $c = put_string("if\n"); } elseif ($x !== 0) { $c = put_string("elseif\n"); } else { $c = put_string("else\n"); } $c = put_string("only else:\n"); if ($x === 0) { $c = put_string("if\n"); } elseif ($x === 0) { $c = put_string("elseif\n"); } else { $c = put_string("else\n"); } $c = put_string("only elseif:\n"); if ($x < 0) { $c = put_string("if\n"); } elseif ($x > 0) { $c = put_string("elseif\n"); } else { $c = put_string("else\n"); } $c = put_string("only elseif:\n"); if ($x < 0) { $c = put_string("if\n"); } elseif ($x > 0) { $c = put_string("elseif\n"); } $c = put_string("else\n");
<?php $x = put_string(strval(true), "\n"); $x = put_string(strval(false), "\n"); $x = put_string(strval(1), "\n"); $x = put_string(strval(0), "\n"); $x = put_string(strval("2"), "\n"); $x = put_string(strval(""), "\n"); $x = put_string(strval(1.1), "\n"); $x = put_string(strval(0.0), "\n"); $x = put_string(strval(null), "\n");
<?php $s = doubleval("1e2 ew"); $x = put_string($s, " = 100 \n"); $s = doubleval("e2 ew"); $x = put_string($s, " = 0 \n"); $s = doubleval("1.1e2 ew"); $x = put_string($s, " = 110 \n"); $s = doubleval("1.1.e2 ew"); $x = put_string($s, " = 1.1 \n"); $s = doubleval("1.1e2ew"); $x = put_string($s, " = 110 \n"); $s = doubleval(".e2 ew"); $x = put_string($s, " = 0 \n"); $s = doubleval("1.1e1.2w2 ew"); $x = put_string($s, " = 11 \n"); $s = doubleval("1.1e");
<?php function ackermann($m, $n) { $x = 4; $y = 2; $z = 14; $foo = "lajflajf"; $boo = "afljadjfj"; if ($m === 0) { return $n + $y * $x + $x * $y - 4 - $x - $x - 3; } elseif ($n === 0) { return ackermann($m - $y * $x + $x * $y - 4 - $x - $x - 3 + $z, 1); } return ackermann($m - $y * $x + $x * $y - 4 - $x - $x - 3 + $z, ackermann($m, $n - $y * $x + $x * $y - 4 - $x - $x - 3 + $z)); } $p = put_string(ackermann(3, 10), "\n");
<?php $a = "3."; $b = "1eč"; $c = $a . $b; $ret = doubleval($c); $p = put_string($ret);
$a = doubleval(" 0.2"); $foo = put_string("doubleval(\" 0.2\")", " = ", $a, "\n\n"); $a = doubleval(" 0.2e25"); $foo = put_string("doubleval(\" 0.2e25\")", " = ", $a, "\n\n"); $a = doubleval(" 0.2.e+45"); $foo = put_string("doubleval(\" 0.2.e+45\")", " = ", $a, "\n\n"); $a = doubleval(" 0.2.e-45"); $foo = put_string("doubleval(\" 0.2.e-45\")", " = ", $a, "\n\n"); $a = doubleval(" 0.2e-00045"); $foo = put_string("doubleval(\" 0.2e-00045\")", " = ", $a, "\n\n"); $a = doubleval(" 0.0"); $foo = put_string("doubleval(\" 0.0\")", " = ", $a, "\n\n"); $a = doubleval(" .3"); $foo = put_string("doubleval(\" .3\")", " = ", $a, "\n\n"); $a = doubleval(" 2e2e2"); $foo = put_string("doubleval(\" 2e2e2\")", " = ", $a, "\n\n"); //*****************chybne stavy - vsetky otestovane****************************** // $a = doubleval(" 00.e"); // $foo = put_string( "doubleval(\"00.e\")", " = ", $a , "\n\n" ); // $a = doubleval(" 3.1e"); // $foo = put_string( "doubleval(\"3.1e\")", " = ", $a , "\n\n" ); // $a = doubleval(" 31"); // $foo = put_string( "doubleval(\" 31\")", " = ", $a , "\n\n" ); // $a = doubleval(" 3."); // $foo = put_string( "doubleval(\" 3.\")", " = ", $a , "\n\n" ); // $a = doubleval(" 8e."); // $foo = put_string( "doubleval(\" 8e.\")", " = ", $a , "\n\n" ); // $a = doubleval(" 8.."); // $foo = put_string( "doubleval(\" 8..\")", " = ", $a , "\n\n" ); // $a = doubleval(" 9e+."); // $foo = put_string( "doubleval(\" 9e+.\")", " = ", $a , "\n\n" );
<?php function my_func($b) { return $b - 2; } $a = my_func($b); $ret = put_string($a);
<?php function ackermann($m, $n) { if ($m === 0) { return $n + 1; } elseif ($n === 0) { return ackermann($m - 1, 1); } return ackermann($m - 1, ackermann($m, $n - 1)); } $p = put_string(ackermann(4, 1), "\n");
<?php $i = 0; while ($i < 20000) { $i = $i + 1; } $x = put_string($i);
<?php $a = 1; $b = 1; $c = 1; function dummy($param) { return $param + 1; } $foo = dummy($a, dummy($b), dummy($c)); $foo = dummy($foo); $foo = $foo; $p = put_string($foo, $a, $b, $c, "\n"); $p = put_string("Jou\n");
<?php $x = "0123456789"; $c = 1 - 2; $a = get_substring($x, $c, 1); $b = put_string($a, "\n");
<?php function stringy($str) { $ret = strlen($str); if ($ret > 100000) { $str = $str . $str; } else { $ret = stringy($str . "a"); } } function a($a) { return $a; } $str = "a" . "b"; $str = a($str); $x = put_string($str); $ret = stringy($str);
<?php $i = 1; while (1) { if ($i < 200000000) { $i = $i + 1; } else { $p = put_string("hodnota i je :", $i); return $i; } }
<?php $a = 5; $b = 5; $c = $a - $b; $d = $a / $c; $ret = put_string($d);