3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pdo = new pdo('sqlite::memory:', null, null, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,PDO::ATTR_EMULATE_PREPARES => false]); $pdo->exec('create table test1 (id int, name text)'); $pdo->exec("insert into test1(id, name) values (1, 'abc'), (2, 'def')"); $stmt = $pdo->prepare('SELECT * FROM test1 WHERE id = :id AND name = :name'); var_dump($stmt->execute(['name' => 'abc', 'id' => 1])); foreach ($stmt as $row) { print_r($row); } echo "\n-----\n"; var_dump($stmt->execute(['name' => 'abc', 1])); foreach ($stmt as $row) { print_r($row); } echo "\n-----\n"; var_dump($stmt->execute(['name' => 'abc', 2])); foreach ($stmt as $row) { print_r($row); } echo "\n-----\n";

preferences:
56.61 ms | 402 KiB | 5 Q