3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arrVal = array ( '22' => array( '0' => 60, '29' => array( '0' => 6 ), '30' => array ( '0' => 5, '1' => 8 ), '31' => array ( '0' => 7, '1' => 9, '2' => 14, '3' => 26 ) ), '23' => 12, '35' => 10, '42' => 22 ); //60[6][5||8][7||9||14||26]|12|10|22 $constructedValue = ""; echo $constructedValue = implodeMultiArr($arrVal); function implodeMultiArr($arrVal) { foreach ( $arrVal as $k=>$v) { if ( is_array($v) ) { $constructedValue .= "[".implodeMultiArr($v)."]"; } else { $constructedValue .= $v."||"; } } return $constructedValue; }
based on 8KANN
Output for 5.0.4 - 7.2.0
Notice: Undefined variable: constructedValue in /in/BepZX on line 31 Notice: Undefined variable: constructedValue in /in/BepZX on line 31 Notice: Undefined variable: constructedValue in /in/BepZX on line 31 Notice: Undefined variable: constructedValue in /in/BepZX on line 31 Notice: Undefined variable: constructedValue in /in/BepZX on line 29 [60||[6||][5||8||][7||9||14||26||]]12||10||22||
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: constructedValue in /in/BepZX on line 31 Notice: Undefined variable: constructedValue in /in/BepZX on line 31 Notice: Undefined variable: constructedValue in /in/BepZX on line 31 Notice: Undefined variable: constructedValue in /in/BepZX on line 31 Notice: Undefined variable: constructedValue in /in/BepZX on line 29 [60||[6||][5||8||][7||9||14||26||]]12||10||22||