3v4l.org

run code in 300+ PHP versions simultaneously
<?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 = ""; $glue = "||"; echo $constructedValue = implodeMultiArr($arrVal,$glue); function implodeMultiArr($arrVal,$glue) { $i = 0; $constructedValue = ""; foreach ( $arrVal as $k=>$v) { if ( is_array($v) ) { $constructedValue .= !empty($constructedValue) ? "[".implodeMultiArr($v,$glue)."]" : implodeMultiArr($v)."]" ; } else { $constructedValue .= !empty($constructedValue) ? $glue.$v : $v ; } $i++; } return $constructedValue; }
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught ArgumentCountError: Too few arguments to function implodeMultiArr(), 1 passed in /in/lSWVA on line 32 and exactly 2 expected in /in/lSWVA:27 Stack trace: #0 /in/lSWVA(32): implodeMultiArr(Array) #1 /in/lSWVA(26): implodeMultiArr(Array, '||') #2 {main} thrown in /in/lSWVA on line 27
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
52.81 ms | 401 KiB | 8 Q