3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $string = '|23&65|567&89.7|90&65.35'; $ar = explode("|", $string); $ar = array_slice($ar, 1, sizeof($ar)); $ir = array(0); foreach($ar as $key => $a) { $er = explode('&', $a); $ir[$er[0]] = $er[1]; } echo(var_dump($ar)); echo(var_dump($ir));
Output for 4.3.0 - 7.1.0
array(3) { [0]=> string(5) "23&65" [1]=> string(8) "567&89.7" [2]=> string(8) "90&65.35" } array(4) { [0]=> int(0) [23]=> string(2) "65" [567]=> string(4) "89.7" [90]=> string(5) "65.35" }