3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pdo = new PDO('sqlite::memory:'); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $pdo->exec("DROP TABLE IF EXISTS prefs"); $pdo->exec("CREATE TABLE prefs( uid MEDIUMINT UNSIGNED NOT NULL, show_email BOOL NOT NULL, show_smiles BOOL NOT NULL, timezone_offset TINYINT NOT NULL, messages_on_page TINYINT UNSIGNED NOT NULL)"); // Insert first row $pdo->exec("INSERT INTO prefs VALUES(6, 1, 1, 0, 5)"); // Update row with id = 6 $prefs = array( 'show_email' => (bool) 1, 'show_smiles' => (bool) 1, 'timezone_offset' => 0, 'messages_on_page' => 999, 'uid', 6 ); $st = $pdo->prepare("UPDATE prefs SET show_email=?, show_smiles=?, timezone_offset=?, messages_on_page=? WHERE uid=?"); $st->bindValue(1, $prefs['show_email'], PDO::PARAM_BOOL); $st->bindValue(2, $prefs['show_smiles'], PDO::PARAM_BOOL); $st->bindValue(3, $prefs['timezone_offset'], PDO::PARAM_INT); $st->bindValue(4, $prefs['messages_on_page'], PDO::PARAM_INT); $id = 6; $st->bindParam(5, $id, PDO::PARAM_INT); if (!$st->execute()) { print_r($pdo->errorInfo()); exit; } $statement = $pdo->prepare('SELECT * FROM prefs'); $statement->execute(); print_r($statement->fetchAll(PDO::FETCH_ASSOC));
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.30, 8.3.0 - 8.3.29, 8.4.1 - 8.4.14, 8.4.16, 8.5.0 - 8.5.1
Array ( [0] => Array ( [uid] => 6 [show_email] => 1 [show_smiles] => 1 [timezone_offset] => 0 [messages_on_page] => 999 ) )
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
199.65 ms | 407 KiB | 5 Q