3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test_val_as_array($val) { $type = gettype($val); echo "val before access = ".var_export($val, true)."\n"; echo "accessing $type as array {$val['test']}\n"; $val['test'] = 'wtf'; echo "set $type offset test to string wtf\n"; echo "accessing $type offset test {$val['test']}\n"; echo "val after access = ".var_export($val, true)."\n"; }; test_val_as_array(null); test_val_as_array('test'); test_val_as_array(123); test_val_as_array(true); test_val_as_array(1.2); test_val_as_array(new stdClass);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PEICX
function name:  (null)
number of ops:  21
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'test_val_as_array'
          1        SEND_VAL                                                 null
          2        DO_FCALL                                      0          
   14     3        INIT_FCALL                                               'test_val_as_array'
          4        SEND_VAL                                                 'test'
          5        DO_FCALL                                      0          
   15     6        INIT_FCALL                                               'test_val_as_array'
          7        SEND_VAL                                                 123
          8        DO_FCALL                                      0          
   16     9        INIT_FCALL                                               'test_val_as_array'
         10        SEND_VAL                                                 <true>
         11        DO_FCALL                                      0          
   17    12        INIT_FCALL                                               'test_val_as_array'
         13        SEND_VAL                                                 1.2
         14        DO_FCALL                                      0          
   18    15        INIT_FCALL                                               'test_val_as_array'
         16        NEW                                              $5      'stdClass'
         17        DO_FCALL                                      0          
         18        SEND_VAR                                                 $5
         19        DO_FCALL                                      0          
         20      > RETURN                                                   1

Function test_val_as_array:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PEICX
function name:  test_val_as_array
number of ops:  38
compiled vars:  !0 = $val, !1 = $type
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        GET_TYPE                                         ~2      !0
          2        ASSIGN                                                   !1, ~2
    5     3        INIT_FCALL                                               'var_export'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $4      
          7        CONCAT                                           ~5      'val+before+access+%3D+', $4
          8        CONCAT                                           ~6      ~5, '%0A'
          9        ECHO                                                     ~6
    6    10        ROPE_INIT                                     5  ~9      'accessing+'
         11        ROPE_ADD                                      1  ~9      ~9, !1
         12        ROPE_ADD                                      2  ~9      ~9, '+as+array+'
         13        FETCH_DIM_R                                      ~7      !0, 'test'
         14        ROPE_ADD                                      3  ~9      ~9, ~7
         15        ROPE_END                                      4  ~8      ~9, '%0A'
         16        ECHO                                                     ~8
    7    17        ASSIGN_DIM                                               !0, 'test'
         18        OP_DATA                                                  'wtf'
    8    19        ROPE_INIT                                     3  ~14     'set+'
         20        ROPE_ADD                                      1  ~14     ~14, !1
         21        ROPE_END                                      2  ~13     ~14, '+offset+test+to+string+wtf%0A'
         22        ECHO                                                     ~13
    9    23        ROPE_INIT                                     5  ~18     'accessing+'
         24        ROPE_ADD                                      1  ~18     ~18, !1
         25        ROPE_ADD                                      2  ~18     ~18, '+offset+test+'
         26        FETCH_DIM_R                                      ~16     !0, 'test'
         27        ROPE_ADD                                      3  ~18     ~18, ~16
         28        ROPE_END                                      4  ~17     ~18, '%0A'
         29        ECHO                                                     ~17
   10    30        INIT_FCALL                                               'var_export'
         31        SEND_VAR                                                 !0
         32        SEND_VAL                                                 <true>
         33        DO_ICALL                                         $21     
         34        CONCAT                                           ~22     'val+after+access+%3D+', $21
         35        CONCAT                                           ~23     ~22, '%0A'
         36        ECHO                                                     ~23
   11    37      > RETURN                                                   null

End of function test_val_as_array

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.03 ms | 1403 KiB | 21 Q