3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Amount { var $amount; } class TaxedAmount extends Amount { var $rate; function __toString() { return $this->amount * $this->rate; } } $item = new TaxedAmount; $item->amount = 242.0; $item->rate = 1.13; echo "You owe me $" . $item->__toString(). " for this answer.";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cOOCa
function name:  (null)
number of ops:  14
compiled vars:  !0 = $item
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   DECLARE_CLASS                                                'taxedamount', 'amount'
   11     1        NEW                                                  $1      'TaxedAmount'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $1
   12     4        ASSIGN_OBJ                                                   !0, 'amount'
          5        OP_DATA                                                      242
   13     6        ASSIGN_OBJ                                                   !0, 'rate'
          7        OP_DATA                                                      1.13
   14     8        INIT_METHOD_CALL                                             !0, '__toString'
          9        DO_FCALL                                          0  $6      
         10        CONCAT                                               ~7      'You+owe+me+%24', $6
         11        CONCAT                                               ~8      ~7, '+for+this+answer.'
         12        ECHO                                                         ~8
         13      > RETURN                                                       1

Class Amount: [no user functions]
Class TaxedAmount:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cOOCa
function name:  __toString
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   FETCH_OBJ_R                                          ~0      'amount'
          1        FETCH_OBJ_R                                          ~1      'rate'
          2        MUL                                                  ~2      ~0, ~1
          3        VERIFY_RETURN_TYPE                                           ~2
          4      > RETURN                                                       ~2
    9     5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of function __tostring

End of class TaxedAmount.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
171.13 ms | 2092 KiB | 12 Q