3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function Query(){ # read params $args = func_get_args(); # replace parameter after parameter, escape (SQL injection) and non-numeric encapsule with '' for($i=1; $i < Count($args); $i++){ if(get_magic_quotes_gpc() == 0) $arg = mysql_real_escape_string($args[$i]); else $arg = mysql_real_escape_string(stripslashes($args[$i])); $arg = strtr($arg, array('#'=>'[hash]')); if($arg != 'NULL') $arg = (is_numeric($arg))? $arg : "'".$arg."'"; $args[0] = substr_replace($args[0], $arg, strPos($args[0], '#'),1); } $args[0] .= ';'; return $args[0]; } $ID = 501; $check_sql = Query("update user_info set login_counter=login_counter+1, date_last_login=NOW() where id_twitter = #", $id); ECHO $check_sql;
based on 62BeK
Output for 7.0.0 - 7.1.0
Notice: Undefined variable: id in /in/sIWpt on line 24 Fatal error: Uncaught Error: Call to undefined function mysql_real_escape_string() in /in/sIWpt:10 Stack trace: #0 /in/sIWpt(24): Query('update user_inf...', NULL) #1 {main} thrown in /in/sIWpt on line 10
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Notice: Undefined variable: id in /in/sIWpt on line 24 Fatal error: Call to undefined function mysql_real_escape_string() in /in/sIWpt on line 10
Process exited with code 255.
Output for 5.0.4 - 5.3.29
Notice: Undefined variable: id in /in/sIWpt on line 24 Fatal error: Call to undefined function mysql_real_escape_string() in /in/sIWpt on line 11
Process exited with code 255.
Output for 5.0.0 - 5.0.3
Notice: Undefined variable: id in /in/sIWpt on line 24 Fatal error: Call to undefined function mysql_real_escape_string() in /in/sIWpt on line 11
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Notice: Undefined variable: id in /in/sIWpt on line 24 Warning: mysql_real_escape_string(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /in/sIWpt on line 11 Warning: mysql_real_escape_string(): A link to the server could not be established in /in/sIWpt on line 11 update user_info set login_counter=login_counter+1, date_last_login=NOW() where id_twitter = '';
Output for 4.3.0 - 4.3.1
Notice: Undefined variable: id in /in/sIWpt on line 24 Warning: mysql_real_escape_string() [http://www.php.net/function.mysql-real-escape-string]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /in/sIWpt on line 11 Warning: mysql_real_escape_string() [http://www.php.net/function.mysql-real-escape-string]: A link to the server could not be established in /in/sIWpt on line 11 update user_info set login_counter=login_counter+1, date_last_login=NOW() where id_twitter = '';