3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "<!doctype html>\n"; $username = @$_GET['username'] ? $_GET['username'] : @$argv[1]; $password = @$_GET['password'] ? $_GET['password'] : @$argv[2]; $password = md5($password); $pdo = new PDO('sqlite::memory:'); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $pdo->exec("DROP TABLE IF EXISTS users"); $pdo->exec("CREATE TABLE users (username VARCHAR(255), password VARCHAR(255))"); $rootPassword = md5("secret"); $pdo->exec("INSERT INTO users (username, password) VALUES ('root', '$rootPassword');"); $statement = $pdo->query("SELECT * FROM users WHERE username = '$username' AND password = '$password'"); if (count($statement->fetchAll())) { echo "Access granted to $username!<br>\n"; } else { echo "Access denied for $username!<br>\n"; }
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
<!doctype html> Deprecated: md5(): Passing null to parameter #1 ($string) of type string is deprecated in /in/6rIhl on line 6 Access denied for !<br>
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 <!doctype html> Deprecated: md5(): Passing null to parameter #1 ($string) of type string is deprecated in /in/6rIhl on line 6 Access denied for !<br>
Output for 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
<!doctype html> Access denied for !<br>
Output for 5.1.4 - 5.1.6
<!doctype html> Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in /in/6rIhl:7 Stack trace: #0 /in/6rIhl(7): PDO->__construct('sqlite::memory:') #1 {main} thrown in /in/6rIhl on line 7
Process exited with code 255.
Output for 5.1.0 - 5.1.3
<!doctype html> Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1 near "EXISTS": syntax error' in /in/6rIhl:9 Stack trace: #0 /in/6rIhl(9): PDO->exec('DROP TABLE IF E...') #1 {main} thrown in /in/6rIhl on line 9
Process exited with code 255.
Output for 5.0.0 - 5.0.5
<!doctype html> Fatal error: Class 'PDO' not found in /in/6rIhl on line 7
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected ',', expecting '(' in /in/6rIhl on line 8
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected ',', expecting '(' in /in/6rIhl on line 8
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `'('' in /in/6rIhl on line 8
Process exited with code 255.

preferences:
196.66 ms | 401 KiB | 313 Q