3v4l.org

run code in 300+ PHP versions simultaneously
<?php class LazyException extends Exception { public function __construct() { parent::__construct('Hello'); $this->message = new class() { public function __toString() { return 'World'; } }; } } $e = new LazyException(); try { throw $e; } catch (\Exception $e) { 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/uTHuC
function name:  (null)
number of ops:  11
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                                                      ->10
   22     5  E > > CATCH                                       last         'Exception'
   23     6    >   INIT_METHOD_CALL                                         !0, 'getMessage'
          7        DO_FCALL                                      0  $4      
          8        ECHO                                                     $4
   24     9        ECHO                                                     '%0A'
   25    10      > 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/uTHuC
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/uTHuC
function name:  __construct
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_STATIC_METHOD_CALL                                  
          1        SEND_VAL_EX                                              'Hello'
          2        DO_FCALL                                      0          
    9     3        DECLARE_ANON_CLASS                               <resource>  
          4        NEW                                              $3      $2
          5        DO_FCALL                                      0          
          6        ASSIGN_OBJ                                               'message'
          7        OP_DATA                                                  $3
   15     8      > RETURN                                                   null

End of function __construct

End of class LazyException.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.48 ms | 1395 KiB | 13 Q