3v4l.org

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

Class foo:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QU6C2
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:
149.12 ms | 1395 KiB | 17 Q