3v4l.org

run code in 300+ PHP versions simultaneously
<?php $db = new PDO("sqlite::memory:"); $db->setAttribute( # raise exceptions PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->query( # you already have a table "CREATE TABLE data (one INT, two INT, three INT, four INT, five INT);"); $stmt = $db->prepare( # prepare query, one placeholding ? for each column left of VALUES "INSERT INTO data (one, two, three, four, five) VALUES(?, ?, ?, ?, ?);"); foreach ([ [1,2,3,4,5], # a row from csv [6,7,8,9,0] # another row from csv ] as $row) { $stmt->execute($row); } $result = $db->query("SELECT * FROM data"); # show it was inserted while ($row = $result->fetch(PDO::FETCH_ASSOC)) { var_dump($row); } ?>
Output for git.master, git.master_jit, rfc.property-hooks
array(5) { ["one"]=> int(1) ["two"]=> int(2) ["three"]=> int(3) ["four"]=> int(4) ["five"]=> int(5) } array(5) { ["one"]=> int(6) ["two"]=> int(7) ["three"]=> int(8) ["four"]=> int(9) ["five"]=> int(0) }

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:
117.68 ms | 406 KiB | 5 Q