3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); class Amount { var $amount; } class TaxedAmount extends Amount { var $rate; function __toString(): float { 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/AbObF
function name:  (null)
number of ops:  14
compiled vars:  !0 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   DECLARE_CLASS                                            'taxedamount', 'amount'
   12     1        NEW                                              $1      'TaxedAmount'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   13     4        ASSIGN_OBJ                                               !0, 'amount'
          5        OP_DATA                                                  242
   14     6        ASSIGN_OBJ                                               !0, 'rate'
          7        OP_DATA                                                  1.13
   15     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/AbObF
function name:  __toString
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     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
   10     5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of function __tostring

End of class TaxedAmount.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.85 ms | 1409 KiB | 13 Q