3v4l.org

run code in 500+ PHP versions simultaneously
<?php trait TestTrait { public function execute(int $id) { return $id + 1; } } class TestClass { use TestTrait { execute as executeTrait; } function __construct() { var_dump($this->execute(1)); var_dump($this->executeTrait(2)); } } new TestClass();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ANmkM
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   DECLARE_CLASS                                                'testclass'
   24     1        NEW                                                  $0      'TestClass'
          2        DO_FCALL                                          0          
          3        FREE                                                         $0
          4      > RETURN                                                       1

Class TestTrait:
Function execute:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ANmkM
function name:  execute
number of ops:  4
compiled vars:  !0 = $id
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
    7     1        ADD                                                  ~1      !0, 1
          2      > RETURN                                                       ~1
    8     3*     > RETURN                                                       null

End of function execute

End of class TestTrait.

Class TestClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ANmkM
function name:  __construct
number of ops:  13
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL                                                   'var_dump'
          1        INIT_METHOD_CALL                                             'execute'
          2        SEND_VAL_EX                                                  1
          3        DO_FCALL                                          0  $0      
          4        SEND_VAR                                                     $0
          5        DO_ICALL                                                     
   20     6        INIT_FCALL                                                   'var_dump'
          7        INIT_METHOD_CALL                                             'executeTrait'
          8        SEND_VAL_EX                                                  2
          9        DO_FCALL                                          0  $2      
         10        SEND_VAR                                                     $2
         11        DO_ICALL                                                     
   21    12      > RETURN                                                       null

End of function __construct

End of class TestClass.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.2 ms | 2920 KiB | 14 Q