3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Hoge { const CONST_FOO = 'foo'; public function __construct() { // 定数が存在する場合 print constant('self::CONST_FOO') . PHP_EOL; // PHP8以降では定数が存在しない場合は例外が送出される try { print constant('self::NOT_EXIST'); } catch (Error $e) { print $e->getMessage(); print $e->getTraceAsString(); } } } $obj = new Hoge();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tbFJR
function name:  (null)
number of ops:  4
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $1      'Hoge'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
          3      > RETURN                                                   1

Class Hoge:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
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/tbFJR
function name:  __construct
number of ops:  18
compiled vars:  !0 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'constant'
          1        SEND_VAL                                                 'self%3A%3ACONST_FOO'
          2        DO_ICALL                                         $1      
          3        CONCAT                                           ~2      $1, '%0A'
          4        ECHO                                                     ~2
   14     5        INIT_FCALL                                               'constant'
          6        SEND_VAL                                                 'self%3A%3ANOT_EXIST'
          7        DO_ICALL                                         $3      
          8        ECHO                                                     $3
          9      > JMP                                                      ->17
   15    10  E > > CATCH                                       last         'Error'
   16    11    >   INIT_METHOD_CALL                                         !0, 'getMessage'
         12        DO_FCALL                                      0  $4      
         13        ECHO                                                     $4
   17    14        INIT_METHOD_CALL                                         !0, 'getTraceAsString'
         15        DO_FCALL                                      0  $5      
         16        ECHO                                                     $5
   19    17    > > RETURN                                                   null

End of function __construct

End of class Hoge.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.37 ms | 1400 KiB | 15 Q