3v4l.org

run code in 500+ PHP versions simultaneously
<?php class LazyException extends Exception { public function __construct() { parent::__construct(); $this->message = new class() { public function __toString() { return 'World'; } }; } } $e = new LazyException(); try { throw $e; } catch (\Exception $e) { echo 'Hello '; echo $e->getMessage(); echo "\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
Found catch point at position: 5
Branch analysis from position: 5
2 jumps found. (Code = 107) Position 1 = 6, Position 2 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RGM4p
function name:  (null)
number of ops:  12
compiled vars:  !0 = $e
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   NEW                                                  $1      'LazyException'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   21     3      > THROW                                             0          !0
          4*       JMP                                                          ->11
   22     5  E > > CATCH                                           last         'Exception'
   23     6    >   ECHO                                                         'Hello+'
   24     7        INIT_METHOD_CALL                                             !0, 'getMessage'
          8        DO_FCALL                                          0  $4      
          9        ECHO                                                         $4
   25    10        ECHO                                                         '%0A'
   26    11      > RETURN                                                       1

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

End of function __tostring

End of class class@anonymous.

Class LazyException:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RGM4p
function name:  __construct
number of ops:  8
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   INIT_STATIC_METHOD_CALL                                      
          1        DO_FCALL                                          0          
    9     2        DECLARE_ANON_CLASS                                   <resource>  
          3        NEW                                                  $3      $2
          4        DO_FCALL                                          0          
          5        ASSIGN_OBJ                                                   'message'
          6        OP_DATA                                                      $3
   15     7      > RETURN                                                       null

End of function __construct

End of class LazyException.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.81 ms | 3289 KiB | 13 Q