3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Obc { function __toString() { return "chips"; } } $a = new StdClass(); $b = new Obc(); echo $b; try { echo $a; } catch (Exception $e) { echo "no toString()\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 10
Branch analysis from position: 10
2 jumps found. (Code = 107) Position 1 = 11, Position 2 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/E6VTf
function name:  (null)
number of ops:  13
compiled vars:  !0 = $a, !1 = $b, !2 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'obc'
    7     1        NEW                                              $3      'StdClass'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
    8     4        NEW                                              $6      'Obc'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $6
   10     7        ECHO                                                     !1
   12     8        ECHO                                                     !0
          9      > JMP                                                      ->12
   14    10  E > > CATCH                                       last         'Exception'
   15    11    >   ECHO                                                     'no+toString%28%29%0A'
   16    12    > > RETURN                                                   1

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

End of function __tostring

End of class Obc.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
187.99 ms | 1394 KiB | 13 Q