3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'UPDATE `list` set `item`=?,`type`=? WHERE (`id` = ?);'; $data = array( 'item' => '1', 'type' => 'Are you ok?' ); $pos = 0; $index = 0; do { $pos = strpos($str, '?', $pos); if ($pos === false) { break; } $binding = array_values($data)[$index%count($data)]; $replacement = is_numeric($binding) ? $binding : '"' . $binding . '"'; $str = substr_replace($str, $replacement, $pos, 1); $pos += strlen($replacement); $index++; } while ($pos !== false); echo $str;
Output for git.master, git.master_jit, rfc.property-hooks
UPDATE `list` set `item`=1,`type`="Are you ok?" WHERE (`id` = 1);

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:
41.92 ms | 405 KiB | 5 Q