3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function escape_string($s) { $r = ''; for($i=0;@$s[$i];$i++) { if($s[$i]!='\'') if($s[$i]!='"') if($s[$i]!='\\') if($s[$i]!="\n") if($s[$i]!="\r") if($s[$i]!="\x1a") { $r .= $s[$i]; continue; } $r .= '?'; } return $r; } $password = '{$help}}'; $password = escape_string($SERVER_[aa]); $query = "select 1 from auth where password='{$password}'"; echo($query); ?>
based on U9lSc
Output for 7.2.0 - 7.3.0beta1
Warning: Use of undefined constant aa - assumed 'aa' (this will throw an Error in a future version of PHP) in /in/gdci3 on line 25 Notice: Undefined variable: SERVER_ in /in/gdci3 on line 25 select 1 from auth where password=''
Output for 5.0.4 - 7.1.20
Notice: Use of undefined constant aa - assumed 'aa' in /in/gdci3 on line 25 Notice: Undefined variable: SERVER_ in /in/gdci3 on line 25 select 1 from auth where password=''
Output for 4.3.0 - 5.0.3
Notice: Use of undefined constant aa - assumed 'aa' in /in/gdci3 on line 25 Notice: Undefined variable: SERVER_ in /in/gdci3 on line 25 select 1 from auth where password=''