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 foo(id int primary key, letter text)'); $ids = insert($pdo, 'insert into foo(letter) values(?), (?), (?)', ['a', 'b', 'c']); var_dump($ids, $pdo->query('select * from foo')->fetchAll(PDO::FETCH_ASSOC)); function insert($pdo, string $sql, array $params = []) : array { if (stripos($sql, 'INSERT') !== 0) { throw new InvalidArgumentException('##LG_NOT_AN_INSERT_STATEMENT##'); } //$pdo = $this->getAdapter()->getConnection(); $stmt = $pdo->prepare($sql); $stmt->execute($params); $count = $stmt->rowCount(); $last = $pdo->lastInsertId(); return range($last - $count, $last); }
Output for git.master, git.master_jit, rfc.property-hooks
array(4) { [0]=> int(0) [1]=> int(1) [2]=> int(2) [3]=> int(3) } array(3) { [0]=> array(2) { ["id"]=> NULL ["letter"]=> string(1) "a" } [1]=> array(2) { ["id"]=> NULL ["letter"]=> string(1) "b" } [2]=> array(2) { ["id"]=> NULL ["letter"]=> string(1) "c" } }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
59.18 ms | 402 KiB | 8 Q