3v4l.org

run code in 300+ PHP versions simultaneously
<?php function string_key_iterator() { yield '42' => 'magic'; } function magical_varargs(...$whatever) { return $whatever; } echo "Normal:\n"; $normal_array = iterator_to_array(string_key_iterator()); var_dump( isset($normal_array[42]), isset($normal_array["42"]), array_keys($normal_array) ); echo "\nWeird and broken:\n"; $freaky_array = magical_varargs(...string_key_iterator()); var_dump( isset($freaky_array[42]), isset($freaky_array["42"]), array_keys($freaky_array) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FbcGj
function name:  (null)
number of ops:  36
compiled vars:  !0 = $normal_array, !1 = $freaky_array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ECHO                                                     'Normal%3A%0A'
   11     1        INIT_FCALL                                               'iterator_to_array'
          2        INIT_FCALL                                               'string_key_iterator'
          3        DO_FCALL                                      0  $2      
          4        SEND_VAR                                                 $2
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !0, $3
   12     7        INIT_FCALL                                               'var_dump'
   13     8        ISSET_ISEMPTY_DIM_OBJ                         0  ~5      !0, 42
          9        SEND_VAL                                                 ~5
   14    10        ISSET_ISEMPTY_DIM_OBJ                         0  ~6      !0, 42
         11        SEND_VAL                                                 ~6
   15    12        INIT_FCALL                                               'array_keys'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $7      
         15        SEND_VAR                                                 $7
   12    16        DO_ICALL                                                 
   18    17        ECHO                                                     '%0AWeird+and+broken%3A%0A'
   19    18        INIT_FCALL                                               'magical_varargs'
         19        INIT_FCALL                                               'string_key_iterator'
         20        DO_FCALL                                      0  $9      
         21        SEND_UNPACK                                              $9
         22        CHECK_UNDEF_ARGS                                         
         23        DO_FCALL                                      1  $10     
         24        ASSIGN                                                   !1, $10
   20    25        INIT_FCALL                                               'var_dump'
   21    26        ISSET_ISEMPTY_DIM_OBJ                         0  ~12     !1, 42
         27        SEND_VAL                                                 ~12
   22    28        ISSET_ISEMPTY_DIM_OBJ                         0  ~13     !1, 42
         29        SEND_VAL                                                 ~13
   23    30        INIT_FCALL                                               'array_keys'
         31        SEND_VAR                                                 !1
         32        DO_ICALL                                         $14     
         33        SEND_VAR                                                 $14
   20    34        DO_ICALL                                                 
   24    35      > RETURN                                                   1

Function string_key_iterator:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/FbcGj
function name:  string_key_iterator
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    4     1        YIELD                                                    'magic', '42'
    5     2      > GENERATOR_RETURN                                         

End of function string_key_iterator

Function magical_varargs:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FbcGj
function name:  magical_varargs
number of ops:  3
compiled vars:  !0 = $whatever
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV_VARIADIC                                    !0      
    7     1      > RETURN                                                   !0
    8     2*     > RETURN                                                   null

End of function magical_varargs

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.51 ms | 1011 KiB | 19 Q