3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pdo = new pdo('sqlite::memory:', null, null, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]); $pdo->exec('create table example( foo text, bar int )'); $prepared = $pdo->prepare('select foo from example'); $parameterized = $pdo->prepare('select foo from example where bar = ?'); echo $prepared->queryString, "\n", $parameterized->queryString; $badSyntax = $pdo->prepare('select foo from example from example');
Output for 7.0.0 - 7.0.33, 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.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
select foo from example select foo from example where bar = ? Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1 near "from": syntax error in /in/WFtvg:9 Stack trace: #0 /in/WFtvg(9): PDO->prepare('select foo from...') #1 {main} thrown in /in/WFtvg on line 9
Process exited with code 255.
Output for 5.6.0 - 5.6.40
select foo from example select foo from example where bar = ? Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1 near "from": syntax error' in /in/WFtvg:9 Stack trace: #0 /in/WFtvg(9): PDO->prepare('select foo from...') #1 {main} thrown in /in/WFtvg on line 9
Process exited with code 255.

preferences:
211.18 ms | 401 KiB | 287 Q