3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php if($sweet['customer_username'] == $username){ $cust=$sweet['customer_id']; mysql_query("INSERT INTO `shipping_address`(customer_id,address_line_1,address_line_2,post_code,county) VALUES ('$cust','$adr','$adr2','$pst','$cnty')"); foreach ($_SESSION['sweet'] as $key => $val){ mysql_query("INSERT INTO `sweets_pref`(customer_id, sweet_id, preference) VALUES ('$cust','$key', '$val')") or die('unable to connect to database'); } }
Output for 7.0.0 - 7.1.0
Notice: Undefined variable: sweet in /in/g2HGq on line 3 Notice: Undefined variable: username in /in/g2HGq on line 3 Notice: Undefined variable: sweet in /in/g2HGq on line 4 Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/g2HGq:5 Stack trace: #0 {main} thrown in /in/g2HGq on line 5
Process exited with code 255.
Output for 5.0.4 - 5.6.28
Notice: Undefined variable: sweet in /in/g2HGq on line 3 Notice: Undefined variable: username in /in/g2HGq on line 3 Notice: Undefined variable: sweet in /in/g2HGq on line 4 Fatal error: Call to undefined function mysql_query() in /in/g2HGq on line 5
Process exited with code 255.
Output for 5.0.0 - 5.0.3
Notice: Undefined variable: sweet in /in/g2HGq on line 3 Notice: Undefined variable: username in /in/g2HGq on line 3 Notice: Undefined variable: sweet in /in/g2HGq on line 4 Fatal error: Call to undefined function mysql_query() in /in/g2HGq on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.10, 4.4.0 - 4.4.9
Notice: Undefined variable: sweet in /in/g2HGq on line 3 Notice: Undefined variable: username in /in/g2HGq on line 3 Notice: Undefined variable: sweet in /in/g2HGq on line 4 Notice: Undefined variable: adr in /in/g2HGq on line 5 Notice: Undefined variable: adr2 in /in/g2HGq on line 5 Notice: Undefined variable: pst in /in/g2HGq on line 5 Notice: Undefined variable: cnty in /in/g2HGq on line 5 Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /in/g2HGq on line 5 Warning: mysql_query(): A link to the server could not be established in /in/g2HGq on line 5 Warning: Invalid argument supplied for foreach() in /in/g2HGq on line 6
Output for 4.3.11
Notice: Undefined variable: sweet in /in/g2HGq on line 3 Notice: Undefined variable: username in /in/g2HGq on line 3 Notice: Undefined variable: sweet in /in/g2HGq on line 4 Notice: Undefined variable: adr in /in/g2HGq on line 5 Notice: Undefined variable: adr2 in /in/g2HGq on line 5 Notice: Undefined variable: pst in /in/g2HGq on line 5 Notice: Undefined variable: cnty in /in/g2HGq on line 5 Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /in/g2HGq on line 5 Warning: mysql_query(): A link to the server could not be established in /in/g2HGq on line 5
Output for 4.3.0 - 4.3.1
Notice: Undefined variable: sweet in /in/g2HGq on line 3 Notice: Undefined variable: username in /in/g2HGq on line 3 Notice: Undefined variable: sweet in /in/g2HGq on line 4 Notice: Undefined variable: adr in /in/g2HGq on line 5 Notice: Undefined variable: adr2 in /in/g2HGq on line 5 Notice: Undefined variable: pst in /in/g2HGq on line 5 Notice: Undefined variable: cnty in /in/g2HGq on line 5 Warning: mysql_query() [http://www.php.net/function.mysql-query]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /in/g2HGq on line 5 Warning: mysql_query() [http://www.php.net/function.mysql-query]: A link to the server could not be established in /in/g2HGq on line 5 Warning: Invalid argument supplied for foreach() in /in/g2HGq on line 6