3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $pdo = new pdo('sqlite::memory:', null, null, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]); $pdo->exec('create table foo(a int)'); $pdo->exec('insert into foo values (1), (2), (3), (4)'); $sql = 'select a from foo group by a having a > 2'; $stmt = $pdo->prepare($sql); $stmt->execute(); var_dump($stmt->fetchAll());
Output for 5.6.0 - 5.6.30, hhvm-3.21.3 - 3.22.0, 7.0.0 - 7.3.0rc3
array(2) { [0]=> array(2) { ["a"]=> string(1) "3" [0]=> string(1) "3" } [1]=> array(2) { ["a"]=> string(1) "4" [0]=> string(1) "4" } }
Output for hhvm-3.18.5
Fatal error: Uncaught exception 'Exception' with message '__construct() expects parameter 2 to be string, null given' in /in/S4Gfd:3 Stack trace: #0 /in/S4Gfd(3): PDO->__construct() #1 {main}
Process exited with code 255.