3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait TaxTools { function calculateтax ( $price ) { return self::prop . $price ; } } abstract class Alert{ const prop = 'value__'; abstract function limpopo(); } class Alert2 extends Alert{ use TaxTools; public function limpopo(){ // return self::$foo; return self::foo; } } $obj = new Alert2; echo $obj->calculateтax(8); //value__8 echo '<br>'; echo $obj::calculateтax(8); //value__8 echo '<br>'; echo $obj::limpopo(); //Fatal error: Undefined class constant 'foo'
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Gg10q
function name:  (null)
number of ops:  20
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   DECLARE_CLASS                                            'alert2', 'alert'
   24     1        NEW                                              $1      'Alert2'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   26     4        INIT_METHOD_CALL                                         !0, 'calculate%D1%82ax'
          5        SEND_VAL_EX                                              8
          6        DO_FCALL                                      0  $4      
          7        ECHO                                                     $4
   27     8        ECHO                                                     '%3Cbr%3E'
   28     9        FETCH_CLASS                                   0  $5      !0
         10        INIT_STATIC_METHOD_CALL                                  $5, 'calculate%D1%82ax'
         11        SEND_VAL_EX                                              8
         12        DO_FCALL                                      0  $6      
         13        ECHO                                                     $6
   30    14        ECHO                                                     '%3Cbr%3E'
   31    15        FETCH_CLASS                                   0  $7      !0
         16        INIT_STATIC_METHOD_CALL                                  $7, 'limpopo'
         17        DO_FCALL                                      0  $8      
         18        ECHO                                                     $8
         19      > RETURN                                                   1

Class TaxTools:
Function calculate%D1%82ax:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Gg10q
function name:  calculateтax
number of ops:  5
compiled vars:  !0 = $price
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        FETCH_CLASS_CONSTANT                             ~1      'prop'
          2        CONCAT                                           ~2      ~1, !0
          3      > RETURN                                                   ~2
    5     4*     > RETURN                                                   null

End of function calculate%D1%82ax

End of class TaxTools.

Class Alert:
Function limpopo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Gg10q
function name:  limpopo
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E > > RETURN                                                   null

End of function limpopo

End of class Alert.

Class Alert2:
Function limpopo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Gg10q
function name:  limpopo
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   FETCH_CLASS_CONSTANT                             ~0      'foo'
          1      > RETURN                                                   ~0
   19     2*     > RETURN                                                   null

End of function limpopo

End of class Alert2.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.14 ms | 1399 KiB | 13 Q