3v4l.org

run code in 300+ PHP versions simultaneously
<?php session_start(); $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $city = "Amersfoort"; /* create a prepared statement */ if ($stmt = $mysqli->prepare("SELECT * FROM `users` WHERE username=? AND password=?")) { /* bind parameters for markers */ $stmt->bind_param("ss", $username,$password); /* execute query */ $stmt->execute(); /* bind result variables */ $stmt->bind_result($result); /* fetch value */ $stmt->fetch(); if( count($result) > 0 ){ $_SESSION['authentificated'] = true; $_SESSION['username'] = $username; } /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); ?>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
Fatal error: Uncaught Error: Class "mysqli" not found in /in/YOBGX:3 Stack trace: #0 {main} thrown in /in/YOBGX on line 3
Process exited with code 255.
Output for 7.1.25 - 7.1.28, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught Error: Class 'mysqli' not found in /in/YOBGX:3 Stack trace: #0 {main} thrown in /in/YOBGX on line 3
Process exited with code 255.

preferences:
150.79 ms | 408 KiB | 5 Q