3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { public function __toString() { return 'a string';} } $foo = new foo; $bar = (string) $foo; echo $foo, "\n"; echo $bar, "\n"; var_dump($foo); var_dump($bar);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XDkKQ
function name:  (null)
number of ops:  17
compiled vars:  !0 = $foo, !1 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'foo'
    6     1        NEW                                              $2      'foo'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
    7     4        CAST                                          6  ~5      !0
          5        ASSIGN                                                   !1, ~5
    8     6        ECHO                                                     !0
          7        ECHO                                                     '%0A'
    9     8        ECHO                                                     !1
          9        ECHO                                                     '%0A'
   10    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
   11    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Class foo:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XDkKQ
function name:  __toString
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E > > RETURN                                                   'a+string'
          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:
157.52 ms | 1386 KiB | 15 Q