3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { function __toString() { return "x"; } } $foo = new foo; var_dump(strpos($foo, "x")); var_dump(strpos("x", $foo)); $array = array("x" => "y"); var_dump($array[$foo]); var_dump($foo[0]); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/V8dU4
function name:  (null)
number of ops:  28
compiled vars:  !0 = $foo, !1 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'foo'
    7     1        NEW                                              $2      'foo'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
    8     4        INIT_FCALL                                               'var_dump'
          5        INIT_FCALL                                               'strpos'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 'x'
          8        DO_ICALL                                         $5      
          9        SEND_VAR                                                 $5
         10        DO_ICALL                                                 
    9    11        INIT_FCALL                                               'var_dump'
         12        INIT_FCALL                                               'strpos'
         13        SEND_VAL                                                 'x'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                         $7      
         16        SEND_VAR                                                 $7
         17        DO_ICALL                                                 
   10    18        ASSIGN                                                   !1, <array>
   11    19        INIT_FCALL                                               'var_dump'
         20        FETCH_DIM_R                                      ~10     !1, !0
         21        SEND_VAL                                                 ~10
         22        DO_ICALL                                                 
   12    23        INIT_FCALL                                               'var_dump'
         24        FETCH_DIM_R                                      ~12     !0, 0
         25        SEND_VAL                                                 ~12
         26        DO_ICALL                                                 
   13    27      > RETURN                                                   1

Class foo:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/V8dU4
function name:  __toString
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E > > RETURN                                                   'x'
    5     1*       VERIFY_RETURN_TYPE                                       
          2*     > RETURN                                                   null

End of function __tostring

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.52 ms | 1396 KiB | 17 Q