3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 'This is option: one', 'This is option: two', 'This is option: 😜' ]; $target = [ 'This is option:' => [ 'one', 'two', '😜' ] ]; function convertArr(array $src): array { $prevString = null; $newArray = []; foreach ($src as $string) { if ($prevString) { // stuck here } $prevString = $string; } return $newArray; } assert(convertArr($arr) === $target);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eqGDc
function name:  (null)
number of ops:  12
compiled vars:  !0 = $arr, !1 = $target
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   29     2        ASSERT_CHECK                                             
          3        INIT_FCALL                                               'assert'
          4        INIT_FCALL                                               'convertarr'
          5        SEND_VAR                                                 !0
          6        DO_FCALL                                      0  $4      
          7        IS_IDENTICAL                                     ~5      !1, $4
          8        SEND_VAL                                                 ~5
          9        SEND_VAL                                                 'assert%28convertArr%28%24arr%29+%3D%3D%3D+%24target%29'
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function convertarr:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 6
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 6
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/eqGDc
function name:  convertArr
number of ops:  13
compiled vars:  !0 = $src, !1 = $prevString, !2 = $newArray, !3 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        ASSIGN                                                   !1, null
   19     2        ASSIGN                                                   !2, <array>
   20     3      > FE_RESET_R                                       $6      !0, ->8
          4    > > FE_FETCH_R                                               $6, !3, ->8
   21     5    > > JMPZ                                                     !1, ->6
   24     6    >   ASSIGN                                                   !1, !3
   20     7      > JMP                                                      ->4
          8    >   FE_FREE                                                  $6
   26     9        VERIFY_RETURN_TYPE                                       !2
         10      > RETURN                                                   !2
   27    11*       VERIFY_RETURN_TYPE                                       
         12*     > RETURN                                                   null

End of function convertarr

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.38 ms | 1001 KiB | 15 Q