public function foo() { $k = new something(); echo "wat\n"; blah(); echo "eh\n"; }
function foo() { $x0 = array(1, 2, 3); $x1 = array(1, 2, 3); $x2 = array(1, 2, 3); $x3 = array(1, 2, 3); $x4 = array(1, 2, 3); $x5 = array(1, 2, 3); $x6 = array(1, 2, 3); $x7 = array(1, 2, 3); $x8 = array(1, 2, 3); $x9 = array(1, 2, 3); foreach ($x0 as &$v0) { foreach ($x1 as &$v1) { foreach ($x2 as &$v2) { foreach ($x3 as &$v3) { foreach ($x4 as &$v4) { foreach ($x5 as &$v5) { foreach ($x6 as &$v6) { foreach ($x7 as &$v7) { foreach ($x8 as &$v8) { foreach ($x9 as &$v9) { blah($v9); } } } } } } } } } } }
echo "ddd\n"; } finally { echo "17\n"; } echo "eee\n"; } finally { echo "18\n"; } echo "eee\n"; } echo "fff\n"; } echo "ggg\n"; } finally { echo "19\n"; } echo "hhh\n"; } finally { echo "20\n"; } echo "iii\n"; } catch (A $e) { echo "21\n"; } finally { echo "22\n"; } echo "23\n"; return 24; } var_dump(blah());
echo "inner loop\n"; if ($x == 4 && $y == 3) { echo "before goto after\n"; goto after; echo "after goto after\n"; } if (empty($flag) && $x == 3 && $y == 2) { echo "before goto before\n"; $flag = 1; goto before; echo "after goto before\n"; } echo "inner loop end\n"; } echo "inner try end\n"; } finally { echo "inner finally\n"; } echo "inner finally\n"; } catch (Exception $x) { echo "outer catch\n"; } finally { echo "outer finally\n"; } echo "outer loop end\n"; } after: echo "after label\n"; } blah();
<?php class Foo { } function blah(Foo $a) { } function error() { $a = func_get_args(); var_dump($a); } set_error_handler('error'); blah(new StdClass()); echo "ALIVE!\n";
<?php $aExpectedResults = array(1 => '00/1', 600 => '06/600', 2300 => '23/2300', 12300 => '01/23/12300'); function blah($iId) { $str = (string) $iId; if (strlen($str) < 4) { $str = sprintf('%s%s', str_repeat('0', 4 - strlen($str)), $str); } if (strlen($str) % 2 == 1) { $str = sprintf('0%s', $str); } $str = substr($str, 0, -2); return sprintf("%s/%d", preg_replace('#(\\d\\d)(\\d\\d)#', '\\1/\\2', $str), $iId); } foreach ($aExpectedResults as $iInput => $sWanted) { $sResult = blah($iInput); if ($sResult !== $sWanted) { print "Expected result was {$sWanted}, but got {$sResult} for {$iInput}\n"; } } $aResults = array(); for ($c = 0; $c < 1000000; $c++) { $sResult = blah($c); print $sResult . "\n"; }
<?php //ob_start(); session_start(); $cstr = $_GET['str']; blah($cstr); exit; function blah($cstr) { $old_security_string = $cstr; $security_string = ""; for ($i = 0; $i <= strlen($old_security_string) - 1; $i++) { $str = substr($old_security_string, $i, 1); if ($i % 2 == 0) { $str = strtoupper($str); } $security_string = $security_string . $str . ' '; } $_SESSION["captchaStr"] = $old_security_string; $width = 100; $height = 30; $image = ImageCreate($width, $height); $white = ImageColorAllocate($image, 255, 255, 255); $black = ImageColorAllocate($image, 0, 0, 0); $grey = ImageColorAllocate($image, 120, 120, 120); $red = ImageColorAllocate($image, 132, 12, 4); ImageFill($image, 5, 5, $grey); $font = 8; imagestring($image, 15, 12, 8, $security_string, $white); //ImageString($image, $font, 12, 3, $security_string, $white); ImageRectangle($image, 0, 0, $width - 1, $height - 1, $black);
function foo() { global $x; blah(blah(), $x()); }
function foo() { $x0 = array(1, 2); $x1 = array(1); $x2 = array(1); $x3 = array(1); $x4 = array(1); $x5 = array(1); $x6 = array(1); $x7 = array(1); $x8 = array(1); $x9 = array(1); $xA = array(1, 2, 3, heh()); $xB = array(heh()); $xC = array(heh()); $xD = array(heh()); $xE = array(heh()); $xF = array(1, 2, 3, 4, heh()); $y0 = array(heh()); $y1 = array(heh()); $y2 = array(heh()); $y3 = array(1, 2, heh()); foreach ($x0 as &$v0) { foreach ($x1 as &$v1) { foreach ($x2 as &$v2) { foreach ($x3 as &$v3) { foreach ($x4 as &$v4) { foreach ($x5 as &$v5) { foreach ($x6 as &$v6) { foreach ($x7 as &$v7) { foreach ($x8 as &$v8) { foreach ($x9 as &$v9) { foreach ($xA as &$vA) { foreach ($xB as &$vB) { foreach ($xC as &$vC) { foreach ($xD as &$vD) { foreach ($xE as &$vE) { foreach ($xF as &$vF) { foreach ($y0 as &$V0) { foreach ($y1 as &$V1) { foreach ($y2 as &$V2) { foreach ($y3 as &$V3) { blah($v9); blah($V3); } } } } } } } } } } } } } } } } } } } } }
<?php $var = 1; function blah() { $var = 2; return $var; } $var = blah(); // echo $var; //return the result of $n+2 as an integer function add2($n) { return $n + 2; } $n = 50; //return the result of $s-3 as an integer function subtractthree($s) { return $s - 3; } echo subtractthree(subtractthree(add2($n)));
<?php class One { public function __construct() { assert($this || 0); } } class Two extends One { } class OdEar extends AssertionError { } function blah() { return 1; } $variable = 1; assert(true, "constant message"); assert($variable && $variable || php_sapi_name(), new OdEar("constant message")); assert(false); assert(blah(), blah()); new Two(); new Two(); new Two(); assert(blah() || blah() || blah(), blah() || blah() || blah() || blah()); var_dump(true);