3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Stringable{ public function __toString() { return 'hi';} } class NotStringable{ public function __toString(){}} $stringable = new Stringable(); $notStringable = new NotStringable(); var_dump((string) $stringable); var_dump(is_string((string) $stringable));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/E45X0
function name:  (null)
number of ops:  18
compiled vars:  !0 = $stringable, !1 = $notStringable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'stringable'
    7     1        DECLARE_CLASS                                            'notstringable'
    9     2        NEW                                              $2      'Stringable'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   10     5        NEW                                              $5      'NotStringable'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $5
   12     8        INIT_FCALL                                               'var_dump'
          9        CAST                                          6  ~8      !0
         10        SEND_VAL                                                 ~8
         11        DO_ICALL                                                 
   13    12        INIT_FCALL                                               'var_dump'
         13        CAST                                          6  ~10     !0
         14        TYPE_CHECK                                   64  ~11     ~10
         15        SEND_VAL                                                 ~11
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

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

End of function __tostring

End of class Stringable.

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

End of function __tostring

End of class NotStringable.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.59 ms | 1396 KiB | 15 Q