3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // connect to the database $link = mysql_connect('localhost','root','root'); mysql_select_db("goal_database",$link); function editActivity() { $response = array(); if (isset$_POST["aid"]) { $aid = intval($_POST["aid"]); $query = "Update Activities SET ExerciseID=14 WHERE ActivityID='$aid';"; $result = mysql_query($query) or die(mysql_error()); if ($result) { $response["error"] = false; $response["message"] = "Activity updated successfully!"; } else { $response["error"] = true; $response["message"] = "Failed to update activity!"; } } else { $response["error"] = true; $response["message"] = "Things are missing!"; } // echo json response echo json_encode($response); } editActivity();
Output for 5.4.0 - 5.4.25
Parse error: syntax error, unexpected '$_POST' (T_VARIABLE), expecting '(' in /in/9hvKt on line 8
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in /in/9hvKt on line 8
Process exited with code 255.