3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Tell mysqli to throw an exception if an error occurs */ mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* The table engine has to support transactions */ $mysqli->query("CREATE TABLE IF NOT EXISTS `language` ( Code text NOT NULL, Speakers int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"); /* Start transaction */ $mysqli->begin_transaction(); /* Insert some values */ $mysqli->query("INSERT INTO language(Code, Speakers) VALUES ('DE', 42000123)"); /* Try to insert invalid values */ $language_code = 'FR'; $native_speakers = 'Unknown'; $stmt = $mysqli->prepare('INSERT INTO language VALUES (?,?)'); $stmt->bind_param('ss', $language_code, $native_speakers); $stmt->execute(); /* If code reaches this point without errors then commit the data in database */ $mysqli->commit();
Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Fatal error: Uncaught Error: Call to undefined function mysqli_report() in /in/WiCEu:4 Stack trace: #0 {main} thrown in /in/WiCEu on line 4
Process exited with code 255.
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 Fatal error: Uncaught Error: Call to undefined function mysqli_report() in /in/WiCEu:4 Stack trace: #0 {main} thrown in /in/WiCEu on line 4
Process exited with code 255.

preferences:
164.6 ms | 402 KiB | 183 Q