3v4l.org

run code in 300+ PHP versions simultaneously
<?php $username = $_POST['username']; $pass = $_POST['Password']; $mysqli = new mysqli("localhost", "438613", "website", "438613"); if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; } else{ $username = $mysqli->real_escape_string($username); $pass = $mysqli->real_escape_string($pass); if($row=$mysqli->query("SELECT password FROM accounts WHERE username='$username'")){ if($row->num_rows == 0){ echo "No user with this email!"; header( "refresh:3;url=index.php" ); } else{ $result = $row->fetch_assoc(); $db_pass = $result["password"]; if (password_verify($pass, $db_pass)) { echo "The password is correct!"; session_start(); unset($_SESSION['user']); $_SESSION['user'] = $username; if (isset($_POST['remember'])) { $year = time() + 31536000; setcookie("user", $username, $year);; } header("Location:main.php"); exit(); } else{ echo "Incorrect password!"; header( "refresh:3;url=index.php" ); } } } else{ echo "Select error: (" . $mysqli->errno . ") " . $mysqli->error; } } ?>
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.25, 7.3.0 - 7.3.12, 7.4.0
Notice: Undefined index: username in /in/5OmOM on line 3 Notice: Undefined index: Password in /in/5OmOM on line 4 Fatal error: Uncaught Error: Class 'mysqli' not found in /in/5OmOM:6 Stack trace: #0 {main} thrown in /in/5OmOM on line 6
Process exited with code 255.
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.37, 5.6.0 - 5.6.28
Notice: Undefined index: username in /in/5OmOM on line 3 Notice: Undefined index: Password in /in/5OmOM on line 4 Fatal error: Class 'mysqli' not found in /in/5OmOM on line 6
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Notice: Undefined index: username in /in/5OmOM on line 3 Notice: Undefined index: Password in /in/5OmOM on line 4 Fatal error: Class 'mysqli' not found in /in/5OmOM on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Notice: Undefined index: username in /in/5OmOM on line 3 Notice: Undefined index: Password in /in/5OmOM on line 4 Fatal error: Cannot instantiate non-existent class: mysqli in /in/5OmOM on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Undefined index: username in /in/5OmOM on line 3 Notice: Undefined index: Password in /in/5OmOM on line 4 Fatal error: Cannot instantiate non-existent class: mysqli in /in/5OmOM on line 6

preferences:
188.2 ms | 401 KiB | 245 Q