3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $data['meta'] = array('parameter' => 'jo', 'irgendwas' => 'so'); $data['id'] = 'dsoifjdsf:dsfoijdsoi:dofds'; $mapping = explode(':', $data['id'], 2); $data['meta'] = array_merge($data['meta'], array('parameter' => reset($mapping))); var_dump($mapping, $data);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(2) { [0]=> string(9) "dsoifjdsf" [1]=> string(16) "dsfoijdsoi:dofds" } array(2) { ["meta"]=> array(2) { ["parameter"]=> string(9) "dsoifjdsf" ["irgendwas"]=> string(2) "so" } ["id"]=> string(26) "dsoifjdsf:dsfoijdsoi:dofds" }