3v4l.org

run code in 500+ PHP versions simultaneously
<?php function foo() { $array = [ 'color' => 'blue', 'size' => 'medium', ]; // Using extract. extract($array); var_dump($color); // Not using extract. var_dump($array['color']); $color = $array['color']; var_dump($color); } function bar( $color, $size ) { // Using compact. $array = compact('color', 'size'); var_dump($array); // Not using compact. $array = [ 'color' => $color, 'size' => $size, ]; var_dump($array); $array = []; foreach (['color', 'size'] as $name) { if (isset($$name)) { $array[$name] = $$name; } } var_dump($array); } foo(); bar('blue', 'medium');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JeHnY
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   41     0  E >   INIT_FCALL                                                   'foo'
          1        DO_FCALL                                          0          
   42     2        INIT_FCALL                                                   'bar'
          3        SEND_VAL                                                     'blue'
          4        SEND_VAL                                                     'medium'
          5        DO_FCALL                                          0          
          6      > RETURN                                                       1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JeHnY
function name:  foo
number of ops:  17
compiled vars:  !0 = $array, !1 = $color
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                       !0, <array>
   10     1        INIT_FCALL                                                   'extract'
          2        SEND_REF                                                     !0
          3        DO_ICALL                                                     
   11     4        INIT_FCALL                                                   'var_dump'
          5        SEND_VAR                                                     !1
          6        DO_ICALL                                                     
   14     7        INIT_FCALL                                                   'var_dump'
          8        FETCH_DIM_R                                          ~5      !0, 'color'
          9        SEND_VAL                                                     ~5
         10        DO_ICALL                                                     
   16    11        FETCH_DIM_R                                          ~7      !0, 'color'
         12        ASSIGN                                                       !1, ~7
   17    13        INIT_FCALL                                                   'var_dump'
         14        SEND_VAR                                                     !1
         15        DO_ICALL                                                     
   18    16      > RETURN                                                       null

End of function foo

Function bar:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 25
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 25
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 24
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/JeHnY
function name:  bar
number of ops:  30
compiled vars:  !0 = $color, !1 = $size, !2 = $array, !3 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   20     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   22     2        INIT_FCALL                                                   'compact'
          3        SEND_VAL                                                     'color'
          4        SEND_VAL                                                     'size'
          5        DO_ICALL                                             $4      
          6        ASSIGN                                                       !2, $4
   23     7        INIT_FCALL                                                   'var_dump'
          8        SEND_VAR                                                     !2
          9        DO_ICALL                                                     
   27    10        INIT_ARRAY                                           ~7      !0, 'color'
   28    11        ADD_ARRAY_ELEMENT                                    ~7      !1, 'size'
   26    12        ASSIGN                                                       !2, ~7
   30    13        INIT_FCALL                                                   'var_dump'
         14        SEND_VAR                                                     !2
         15        DO_ICALL                                                     
   32    16        ASSIGN                                                       !2, <array>
   33    17      > FE_RESET_R                                           $11     <array>, ->25
         18    > > FE_FETCH_R                                                   $11, !3, ->25
   34    19    >   ISSET_ISEMPTY_VAR                                 4          !3
         20      > JMPZ                                                         ~12, ->24
   35    21    >   FETCH_R                          local               ~14     !3
         22        ASSIGN_DIM                                                   !2, !3
         23        OP_DATA                                                      ~14
   33    24    > > JMP                                                          ->18
         25    >   FE_FREE                                                      $11
   38    26        INIT_FCALL                                                   'var_dump'
         27        SEND_VAR                                                     !2
         28        DO_ICALL                                                     
   39    29      > RETURN                                                       null

End of function bar

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
166.18 ms | 3440 KiB | 18 Q