3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo() { $reqs = array('11', '22', array('id' => 123, 'name' => 'ffff')); foreach ($reqs as &$req) { if (is_array($req)) { $req['name'] = 'dd'; //alter value } } echo '<pre>'; print_r($reqs); //values changed, ok echo '</pre>'; foreach ($reqs as $req) { echo '<pre>'; print_r($req); //the last value is '22', that is wrong. echo '</pre>'; } } foo();
Output for git.master, git.master_jit, rfc.property-hooks
<pre>Array ( [0] => 11 [1] => 22 [2] => Array ( [id] => 123 [name] => dd ) ) </pre><pre>11</pre><pre>22</pre><pre>22</pre>

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