3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dbh = new PDO("sqlite::memory:", "", "", [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]); $dbh->exec("CREATE TABLE fruits (name TEXT, color TEXT)"); $dbh->exec("INSERT INTO fruits VALUES('banana', 'yellow')"); $sql = "SELECT * FROM fruits WHERE name = :name AND color = ?"; $sth = $dbh->prepare($sql); $sth->execute(["banana", "yellow"]); var_dump($sth->fetchAll());
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.30, 8.0.0 - 8.0.23, 8.1.0 - 8.1.10
array(1) { [0]=> array(4) { ["name"]=> string(6) "banana" [0]=> string(6) "banana" ["color"]=> string(6) "yellow" [1]=> string(6) "yellow" } }

preferences:
52.15 ms | 409 KiB | 5 Q