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

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

End of function implodemultiarr

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.57 ms | 1399 KiB | 13 Q