3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $sortBy = array( 'foo' => 'some', 'bar' => 'not', 'wat' => 'important', 'baz' => 'stuff', ); $dataToSort = array( 'baz' => 'Baz stuff', 'bar' => 'Bar things', 'wat' => 'Simply wat', 'foo' => 'Foo yourself', ); var_dump(array_merge($sortBy, $dataToSort));
Output for 4.3.0 - 7.2.0
array(4) { ["foo"]=> string(12) "Foo yourself" ["bar"]=> string(10) "Bar things" ["wat"]=> string(10) "Simply wat" ["baz"]=> string(9) "Baz stuff" }