3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { function get() { throw new Exception('some error'); } } class B { function __toString() { $a = new A; return $a->get(); } } $b = new B; var_dump((string) $b);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/od3M7
function name:  (null)
number of ops:  9
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   DECLARE_CLASS                                            'b'
   20     1        NEW                                              $1      'B'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   21     4        INIT_FCALL                                               'var_dump'
          5        CAST                                          6  ~4      !0
          6        SEND_VAL                                                 ~4
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Class A:
Function get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/od3M7
function name:  get
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   NEW                                              $0      'Exception'
          1        SEND_VAL_EX                                              'some+error'
          2        DO_FCALL                                      0          
          3      > THROW                                         0          $0
    8     4*     > RETURN                                                   null

End of function get

End of class A.

Class B:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/od3M7
function name:  __toString
number of ops:  9
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $1      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   16     3        INIT_METHOD_CALL                                         !0, 'get'
          4        DO_FCALL                                      0  $4      
          5        VERIFY_RETURN_TYPE                                       $4
          6      > RETURN                                                   $4
   17     7*       VERIFY_RETURN_TYPE                                       
          8*     > RETURN                                                   null

End of function __tostring

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
187.12 ms | 1388 KiB | 15 Q