function main() { f1(); f2(); f3(); f4(); f5(); f6(); f7(); f8(); }
<?php function f6() { $i = 0; $foo = array('f' => 3, 'e' => 1, 'd' => 5, 'a' => 6, 'b' => 2, 'c' => 4); $a = 0; foreach ($foo as $key => &$val) { echo "key={$key} val={$val}\n"; if ($key == 'e' && $a == 0) { $a = 1; unset($foo['e']); unset($foo['d']); $bar['e'] = 8; $foo['d'] = 9; for ($j = 0; $j < 10000; ++$j) { $foo[$j . 's' . $j] = $j; } } ++$i; if ($i >= 20) { break; } } } f6();
} } function f5($x) { switch ($x[0]) { case 0: var_dump($x[0]); } } function f6($x, $y, $z) { if ($z) { goto my_clause; } if ($y) { var_dump($y); } else { if ($x[0]) { var_dump($x[0]); my_clause: var_dump($x); } } } f1(array(0, 0)); f2(array(10)); f3(array(10), false); f4(array(array(1, 2, 3))); f5(array(false, false)); f6(array(true), false, false);
function f4() { f6(); }
{ } function f4(I1 $p1) { echo "Inside " . __METHOD__ . "\n"; var_dump($p1); } //f4(123); // must implement interface I1, integer given f4(new C2()); f4(new D2()); echo "--------------- test type hint callable ---------------------\n"; function hello() { echo "Hello!\n"; } function f5(callable $p1) { echo "Inside " . __METHOD__ . "\n"; var_dump($p1); $p1(); } //f5(123); // must be callable, integer given f5('hello'); echo "--------------- test type hint + by ref ---------------------\n"; function f6(C1 &$p1) { echo "Inside " . __METHOD__ . "\n"; var_dump($p1); } f6(new C1());
function f9($theFile) { global $wimpyApp, $startDir, $defaultVisualBaseName, $defaultVisualExt, $v31, $v81; $v26 = explode(".", str_replace("/", $v81, urldecode($theFile))); array_pop($v26); if ($startDir == "") { $v26 = explode(".", $theFile); array_pop($v26); $v95 = urldecode(implode(".", $v26) . "." . $defaultVisualExt); if (is_file($v95)) { return f6($v95); } else { return false; } } else { $v95 = implode(".", $v26) . "." . $defaultVisualExt; if (strpos($v95, $v31['path']['physical']) === false) { $v95 = $v31['path']['physical'] . $v81 . $v95; } if (is_file($v95)) { $v73 = str_replace($v31['path']['physical'], "", $v95); $v73 = str_replace($v81, "/", $v73); return $wimpyApp . "?action=getCoverart&theFile=" . $v73; } } }
} if (!isset($v65)) { $v65 = "no"; } if (!isset($v66)) { $v66 = "0"; } if ($ecommerce == "yes") { $forceDownload = "no"; $displayDownloadButton = "yes"; $getMyid3info = "yes"; } if (@$_REQUEST['action'] == "writeJS") { $v113 = true; if (strlen(@$wimpySkin) > 4) { if ($v42 = f6($wimpySkin)) { $v122 = @xml_parser_create(''); @xml_parse_into_struct($v122, $v42, $v116, $v61); @xml_parser_free($v122); $v45 = @$v116[@$v61['BKGD_MAIN'][0]]['attributes']['WIDTH']; $v44 = @$v116[@$v61['BKGD_MAIN'][0]]['attributes']['HEIGHT']; } else { $v113 = false; } } else { $v113 = false; } } if ($v45 < 1 || $v44 < 1) { $v113 = false; $v45 = "480";
function bar() { $a = 1; f1($a, $a, $a); var_dump($a); $a = 1; f2($a, $a, $a); var_dump($a); $a = 1; f3($a, $a, $a); var_dump($a); $a = 1; f4($a, $a, $a); var_dump($a); $a = 1; f5($a, $a, $a); var_dump($a); $a = 1; f6($a, $a, $a); var_dump($a); $a = 1; f7($a, $a, $a); var_dump($a); $a = 1; f8($a, $a, $a); var_dump($a); }
$y = (double) $x; var_dump($y); return $y; } var_dump(f1()); var_dump(f2()); var_dump(f3()); var_dump(f4()); var_dump(f5()); var_dump(f6()); var_dump(f1(null)); var_dump(f2(null)); var_dump(f3(null)); var_dump(f4(null)); var_dump(f5(null)); var_dump(f6(null)); function rf1($x) { if ($x) { return 'f1'; } return 0; } function rf2($x) { if ($x) { return 'f2'; } return 0; } function rf3($x)
<?php function f6() { $i = 0; $foo = array('f' => 3, 'e' => 1, 'd' => 5, 'a' => 6, 'b' => 2, 'c' => 4); $a = 0; foreach ($foo as $key => &$val) { (yield null); echo "key={$key} val={$val}\n"; if ($key == 'e' && $a == 0) { $a = 1; unset($foo['e']); unset($foo['d']); $bar['e'] = 8; $foo['d'] = 9; for ($j = 0; $j < 10000; ++$j) { $foo[$j . 's' . $j] = $j; } } ++$i; if ($i >= 20) { break; } } } foreach (f6() as $_) { }
{ print $a; print $b; } f2($HTTP_RAW_POST_DATA, $http_raw_post_data); function f3($a, $b) { echo $a; echo $b; } f3($_SERVER['DOCUMENT_ROOT'], $_SERVER['QUERY_STRING']); function f4($a, $b) { print $a; print $b; } f4($_SERVER['DOCUMENT_ROOT'], $_SERVER['QUERY_STRING']); // Those are called with safe functions. function f5($a, $b) { strtolower($a); strtolower($b); } f5($_SERVER, $_SERVER); function f6($a, $b) { strtolower($a); strtolower($b); } f6($_SERVER['DOCUMENT_ROOT'], $_SERVER['QUERY_STRING']);