3v4l.org

run code in 300+ PHP versions simultaneously
<?php $db = new PDO('sqlite::memory:'); // These are the only reasonable settings to ever use: $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Let's create a table: $db->exec("CREATE TABLE foo (username TEXT, pwhash TEXT, email TEXT)"); // Dummy rows: $db->exec("INSERT INTO foo(username, pwhash, email) VALUES ('scott', 'lolno', 'scott@paragonie.com')"); $db->exec("INSERT INTO foo(username, pwhash, email) VALUES ('robyn', 'fake!', 'robyn@paragonie.com')"); // Okay, now let's do a prepared statement, with an integer field $int = 12345; $stmt = $db->prepare("SELECT * FROM foo WHERE {$int} = ?"); $stmt->bindValue(1, $int, PDO::PARAM_INT); $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { [0]=> array(3) { ["username"]=> string(5) "scott" ["pwhash"]=> string(5) "lolno" ["email"]=> string(19) "scott@paragonie.com" } [1]=> array(3) { ["username"]=> string(5) "robyn" ["pwhash"]=> string(5) "fake!" ["email"]=> string(19) "robyn@paragonie.com" } }

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