3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait Adder { public function calculate(int $x, int $y) { echo $x + $y; } } trait Subtractor { public function calculate(int $x, int $y) { echo $x - $y; } } class StupidCalc { use Adder { calculate as public add; } use Subtractor { calculate as public sub; } function maybeAdd(int $x, int $y) { $this->add($x, $y); } function maybeSub(int $x, int $y) { $this->sub($x, $y); } function calculate(int $x, int $y) {} } $calc = new StupidCalc(); $calc->maybeAdd(3, 2); $calc->maybeSub(3, 2);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/I2thK
function name:  (null)
number of ops:  13
compiled vars:  !0 = $calc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   DECLARE_CLASS                                            'stupidcalc'
   35     1        NEW                                              $1      'StupidCalc'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   37     4        INIT_METHOD_CALL                                         !0, 'maybeAdd'
          5        SEND_VAL_EX                                              3
          6        SEND_VAL_EX                                              2
          7        DO_FCALL                                      0          
   38     8        INIT_METHOD_CALL                                         !0, 'maybeSub'
          9        SEND_VAL_EX                                              3
         10        SEND_VAL_EX                                              2
         11        DO_FCALL                                      0          
         12      > RETURN                                                   1

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

End of function calculate

End of class Adder.

Class Subtractor:
Function calculate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/I2thK
function name:  calculate
number of ops:  5
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        SUB                                              ~2      !0, !1
          3        ECHO                                                     ~2
   12     4      > RETURN                                                   null

End of function calculate

End of class Subtractor.

Class StupidCalc:
Function maybeadd:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/I2thK
function name:  maybeAdd
number of ops:  7
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   25     2        INIT_METHOD_CALL                                         'add'
          3        SEND_VAR_EX                                              !0
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0          
   26     6      > RETURN                                                   null

End of function maybeadd

Function maybesub:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/I2thK
function name:  maybeSub
number of ops:  7
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   29     2        INIT_METHOD_CALL                                         'sub'
          3        SEND_VAR_EX                                              !0
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0          
   30     6      > RETURN                                                   null

End of function maybesub

Function calculate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/I2thK
function name:  calculate
number of ops:  3
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2      > RETURN                                                   null

End of function calculate

End of class StupidCalc.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.38 ms | 1399 KiB | 13 Q