3v4l.org

run code in 300+ PHP versions simultaneously
<?php function by_tag($things) { $sorted = array(); foreach ($things as $thing) { $thing['title'] = "new title"; # this works! $thing['size'] = 100; # this doesn't work, it keeps the old value. array_push($sorted, $thing); } return $sorted; } $unsorted = array( array('foo' => 'bar', 'size' => 1, 'title' => 'changeme1'), array('foo' => 'bar', 'size' => 2, 'title' => 'changeme2'), array('foo' => 'bar', 'size' => 3, 'title' => 'changeme3'), array('foo' => 'bar', 'size' => 4, 'title' => 'changeme4'), array('foo' => 'bar', 'size' => 5, 'title' => 'changeme5') ); var_dump(by_tag($unsorted));
Output for git.master, git.master_jit, rfc.property-hooks
array(5) { [0]=> array(3) { ["foo"]=> string(3) "bar" ["size"]=> int(100) ["title"]=> string(9) "new title" } [1]=> array(3) { ["foo"]=> string(3) "bar" ["size"]=> int(100) ["title"]=> string(9) "new title" } [2]=> array(3) { ["foo"]=> string(3) "bar" ["size"]=> int(100) ["title"]=> string(9) "new title" } [3]=> array(3) { ["foo"]=> string(3) "bar" ["size"]=> int(100) ["title"]=> string(9) "new title" } [4]=> array(3) { ["foo"]=> string(3) "bar" ["size"]=> int(100) ["title"]=> string(9) "new title" } }

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:
35.41 ms | 402 KiB | 8 Q