3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Hook { public function __construct( public string $hook, public string $method = '', public ?string $module = NULL, ) {} } class Alter extends Hook { public function __construct( public string $hook, public string $method = '', public ?string $module = NULL, ) { parent::__construct($hook . '_alter'); } } class FormAlter extends Alter { public function __construct( public string $hook = '', public string $method = '', public ?string $module = NULL, ) { parent::__construct($hook ? 'form_' . $hook : 'form'); } } var_dump(new Alter('foo')); var_dump(new FormAlter()); var_dump(new FormAlter('foo'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5brVa
function name:  (null)
number of ops:  18
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   INIT_FCALL                                               'var_dump'
          1        NEW                                              $0      'Alter'
          2        SEND_VAL_EX                                              'foo'
          3        DO_FCALL                                      0          
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
   33     6        INIT_FCALL                                               'var_dump'
          7        NEW                                              $3      'FormAlter'
          8        DO_FCALL                                      0          
          9        SEND_VAR                                                 $3
         10        DO_ICALL                                                 
   34    11        INIT_FCALL                                               'var_dump'
         12        NEW                                              $6      'FormAlter'
         13        SEND_VAL_EX                                              'foo'
         14        DO_FCALL                                      0          
         15        SEND_VAR                                                 $6
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Class Hook:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5brVa
function name:  __construct
number of ops:  10
compiled vars:  !0 = $hook, !1 = $method, !2 = $module
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      ''
          2        RECV_INIT                                        !2      null
          3        ASSIGN_OBJ                                               'hook'
          4        OP_DATA                                                  !0
          5        ASSIGN_OBJ                                               'method'
          6        OP_DATA                                                  !1
          7        ASSIGN_OBJ                                               'module'
          8        OP_DATA                                                  !2
    9     9      > RETURN                                                   null

End of function __construct

End of class Hook.

Class Alter:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5brVa
function name:  __construct
number of ops:  14
compiled vars:  !0 = $hook, !1 = $method, !2 = $module
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      ''
          2        RECV_INIT                                        !2      null
          3        ASSIGN_OBJ                                               'hook'
          4        OP_DATA                                                  !0
          5        ASSIGN_OBJ                                               'method'
          6        OP_DATA                                                  !1
          7        ASSIGN_OBJ                                               'module'
          8        OP_DATA                                                  !2
   18     9        INIT_STATIC_METHOD_CALL                                  
         10        CONCAT                                           ~3      !0, '_alter'
         11        SEND_VAL_EX                                              ~3
         12        DO_FCALL                                      0          
   19    13      > RETURN                                                   null

End of function __construct

End of class Alter.

Class FormAlter:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5brVa
function name:  __construct
number of ops:  18
compiled vars:  !0 = $hook, !1 = $method, !2 = $module
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV_INIT                                        !0      ''
          1        RECV_INIT                                        !1      ''
          2        RECV_INIT                                        !2      null
          3        ASSIGN_OBJ                                               'hook'
          4        OP_DATA                                                  !0
          5        ASSIGN_OBJ                                               'method'
          6        OP_DATA                                                  !1
          7        ASSIGN_OBJ                                               'module'
          8        OP_DATA                                                  !2
   28     9        INIT_STATIC_METHOD_CALL                                  
         10      > JMPZ                                                     !0, ->14
         11    >   CONCAT                                           ~3      'form_', !0
         12        QM_ASSIGN                                        ~4      ~3
         13      > JMP                                                      ->15
         14    >   QM_ASSIGN                                        ~4      'form'
         15    >   SEND_VAL_EX                                              ~4
         16        DO_FCALL                                      0          
   29    17      > RETURN                                                   null

End of function __construct

End of class FormAlter.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.45 ms | 1015 KiB | 14 Q