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 = ""; echo $constructedValue = implodeMultiArr($arrVal); function implodeMultiArr($arrVal) { $i = 0; foreach ( $arrVal as $k=>$v) { if ( is_array($v) ) { $constructedValue .= "[".implodeMultiArr($v)."]"; } else { $constructedValue .= ($i > 0 ) ? "||".$v : $v ; } $i++; } return $constructedValue; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ndUhp
function name:  (null)
number of ops:  8
compiled vars:  !0 = $arrVal, !1 = $constructedValue
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   24     1        ASSIGN                                                   !1, ''
   25     2        INIT_FCALL_BY_NAME                                       'implodeMultiArr'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                           ~5      !1, $4
          6        ECHO                                                     ~5
   37     7      > RETURN                                                   1

Function implodemultiarr:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 23
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 23
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/ndUhp
function name:  implodeMultiArr
number of ops:  26
compiled vars:  !0 = $arrVal, !1 = $i, !2 = $v, !3 = $k, !4 = $constructedValue
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
   27     1        ASSIGN                                                   !1, 0
   28     2      > FE_RESET_R                                       $6      !0, ->23
          3    > > FE_FETCH_R                                       ~7      $6, !2, ->23
          4    >   ASSIGN                                                   !3, ~7
   29     5        TYPE_CHECK                                  128          !2
          6      > JMPZ                                                     ~9, ->14
   30     7    >   INIT_FCALL_BY_NAME                                       'implodeMultiArr'
          8        SEND_VAR_EX                                              !2
          9        DO_FCALL                                      0  $10     
         10        CONCAT                                           ~11     '%5B', $10
         11        CONCAT                                           ~12     ~11, '%5D'
         12        ASSIGN_OP                                     8          !4, ~12
         13      > JMP                                                      ->21
   32    14    >   IS_SMALLER                                               0, !1
         15      > JMPZ                                                     ~14, ->19
         16    >   CONCAT                                           ~15     '%7C%7C', !2
         17        QM_ASSIGN                                        ~16     ~15
         18      > JMP                                                      ->20
         19    >   QM_ASSIGN                                        ~16     !2
         20    >   ASSIGN_OP                                     8          !4, ~16
   34    21    >   PRE_INC                                                  !1
   28    22      > JMP                                                      ->3
         23    >   FE_FREE                                                  $6
   36    24      > RETURN                                                   !4
   37    25*     > RETURN                                                   null

End of function implodemultiarr

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.64 ms | 1390 KiB | 13 Q