3v4l.org

run code in 300+ PHP versions simultaneously
<?php function traverse($arr){ $result_2 = []; while (key($arr)) { $result_2[key($arr)] = current($arr); next($arr); } print_r($result_2); } $data = [ "k0"=>"v0", "k1"=>"v1", "k2"=>"v2", "k3"=>"v3", "k4"=>"v4", ]; traverse($data); $result_1 = []; while (key($data)) { $result_1[key($data)] = current($data); next($data); } print_r($result_1);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 6
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 6
Branch analysis from position: 21
Branch analysis from position: 6
filename:       /in/l1bYA
function name:  (null)
number of ops:  25
compiled vars:  !0 = $data, !1 = $result_1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, <array>
   20     1        INIT_FCALL                                               'traverse'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0          
   22     4        ASSIGN                                                   !1, <array>
   23     5      > JMP                                                      ->17
   24     6    >   INIT_FCALL                                               'key'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $5      
          9        INIT_FCALL                                               'current'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $7      
         12        ASSIGN_DIM                                               !1, $5
         13        OP_DATA                                                  $7
   25    14        INIT_FCALL                                               'next'
         15        SEND_REF                                                 !0
         16        DO_ICALL                                                 
   23    17    >   INIT_FCALL                                               'key'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $9      
         20      > JMPNZ                                                    $9, ->6
   27    21    >   INIT_FCALL                                               'print_r'
         22        SEND_VAR                                                 !1
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Function traverse:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 3
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 3
Branch analysis from position: 18
Branch analysis from position: 3
filename:       /in/l1bYA
function name:  traverse
number of ops:  22
compiled vars:  !0 = $arr, !1 = $result_2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, <array>
    5     2      > JMP                                                      ->14
    6     3    >   INIT_FCALL                                               'key'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        INIT_FCALL                                               'current'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $5      
          9        ASSIGN_DIM                                               !1, $3
         10        OP_DATA                                                  $5
    7    11        INIT_FCALL                                               'next'
         12        SEND_REF                                                 !0
         13        DO_ICALL                                                 
    5    14    >   INIT_FCALL                                               'key'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $7      
         17      > JMPNZ                                                    $7, ->3
    9    18    >   INIT_FCALL                                               'print_r'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                                 
   10    21      > RETURN                                                   null

End of function traverse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
189.42 ms | 1403 KiB | 22 Q