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; $constructedValue = ""; foreach ( $arrVal as $k=>$v) { if ( is_array($v) ) { $constructedValue .= "[".implodeMultiArr($v)."]"; } else { $constructedValue .= !empty($constructedValue) ? "||".$v : $v ; } $i++; } return $constructedValue; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YUZH3
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
   38     7      > RETURN                                                   1

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

End of function implodemultiarr

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.44 ms | 1390 KiB | 13 Q