3v4l.org

run code in 500+ PHP versions simultaneously
<?php function tableName () { return 'table_name'; } function select (array $columns, array $where) { for ($i = 0; $i < count($where); $i++){ $conditions[] = $where[$i][0] . ' ' . $where[$i][1] . ' :' . $where[$i][0]; $params[] = $where[$i][2]; } $sql = implode(" AND ", array_map(fn($cond) => "$cond", $conditions)); $columns = implode(", ",array_map(fn($att) => "$att",$columns)); echo "SELECT $columns FROM ".tableName()." WHERE $sql"; } $arrayCol = ["username","email"]; $arrayWhere = [["id", ">", 3], ["firstname", "=", "John"]]; select($arrayCol,$arrayWhere); ?>
Output for git.master, git.master_jit, rfc.property-hooks
SELECT username, email FROM table_name WHERE id > :id AND firstname = :firstname

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:
54.59 ms | 1262 KiB | 4 Q