3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $num = 100004313234244; // notice this exceeds 32 bits $conn = new PDO('sqlite::memory:'); $conn->query('CREATE TABLE users (id INTEGER NOT NULL, num INTEGER NOT NULL, PRIMARY KEY(id))'); $stmt = $conn->prepare('insert into users (id, num) values (:id, :num)'); $stmt->bindValue(':id', 1, PDO::PARAM_INT); $stmt->bindValue(':num', $num, PDO::PARAM_INT); $stmt->execute(); $stmt = $conn->query('SELECT num FROM users'); $result = $stmt->fetchAll(PDO::FETCH_COLUMN); printf("Expected: %d Received: %d\n", $num, $result[0]);
Output for 5.1.0 - 5.1.3, 5.2.0 - 5.2.17, 5.4.12 - 5.6.28, 7.0.0 - 7.1.0
Expected: 100004313234244 Received: 100004313234244
Output for 5.3.0 - 5.4.11, hhvm-3.10.0 - 3.12.0
Expected: 100004313234244 Received: 294714180
Output for 5.1.4 - 5.1.6
Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in /in/eDKAc:3 Stack trace: #0 /in/eDKAc(3): PDO->__construct('sqlite::memory:') #1 {main} thrown in /in/eDKAc on line 3
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Fatal error: Class 'PDO' not found in /in/eDKAc on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected ')', expecting '(' in /in/eDKAc on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected ')', expecting '(' in /in/eDKAc on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `'('' in /in/eDKAc on line 7
Process exited with code 255.