3v4l.org

run code in 300+ PHP versions simultaneously
<?php function expandArguments(&$query, &$args) { $modified = FALSE; foreach (array_filter($args, 'is_array') as $key => $data) { $new_keys = array(); foreach ($data as $i => $value) { $new_keys[$key . '_' . $i] = $value; } $query = preg_replace( '#' . $key . '\b#', implode(', ', array_keys($new_keys)), $query ); unset($args[$key]); $args += $new_keys; $modified = TRUE; } return $modified; } $query = "SELECT * FROM foo WHERE id IN (:ids)"; $args = [ 'ids' => [ 1, 2, 3, ] ]; $db->expandArguments($query, $args); var_dump($db); ?>
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $db in /in/oHhYe on line 30 Fatal error: Uncaught Error: Call to a member function expandArguments() on null in /in/oHhYe:30 Stack trace: #0 {main} thrown in /in/oHhYe on line 30
Process exited with code 255.

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:
62.05 ms | 401 KiB | 8 Q