3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php public 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 5.4.0 - 5.4.29
Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /in/e4Vu5 on line 2
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_PUBLIC in /in/e4Vu5 on line 2
Process exited with code 255.