3v4l.org

run code in 500+ PHP versions simultaneously
<?php function calculateTotal(float $price, int $quantity, float $discount = 0.0): float { $total = $price * $quantity; $total = $total - ($total * $discount / 100); return $total; } echo calculateTotal(10000, 2) . " ₸<br>"; echo calculateTotal(15000, 3, 10) . " ₸<br>"; echo calculateTotal(5000, 4, 20) . " ₸<br>"; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pSOU0
function name:  (null)
number of ops:  21
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                                   'calculatetotal'
          1        SEND_VAL                                                     10000
          2        SEND_VAL                                                     2
          3        DO_FCALL                                          0  $0      
          4        CONCAT                                               ~1      $0, '+%E2%82%B8%3Cbr%3E'
          5        ECHO                                                         ~1
    9     6        INIT_FCALL                                                   'calculatetotal'
          7        SEND_VAL                                                     15000
          8        SEND_VAL                                                     3
          9        SEND_VAL                                                     10
         10        DO_FCALL                                          0  $2      
         11        CONCAT                                               ~3      $2, '+%E2%82%B8%3Cbr%3E'
         12        ECHO                                                         ~3
   10    13        INIT_FCALL                                                   'calculatetotal'
         14        SEND_VAL                                                     5000
         15        SEND_VAL                                                     4
         16        SEND_VAL                                                     20
         17        DO_FCALL                                          0  $4      
         18        CONCAT                                               ~5      $4, '+%E2%82%B8%3Cbr%3E'
         19        ECHO                                                         ~5
   11    20      > RETURN                                                       1

Function calculatetotal:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pSOU0
function name:  calculateTotal
number of ops:  13
compiled vars:  !0 = $price, !1 = $quantity, !2 = $discount, !3 = $total
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        RECV_INIT                                            !2      0
    3     3        MUL                                                  ~4      !0, !1
          4        ASSIGN                                                       !3, ~4
    4     5        MUL                                                  ~6      !3, !2
          6        DIV                                                  ~7      ~6, 100
          7        SUB                                                  ~8      !3, ~7
          8        ASSIGN                                                       !3, ~8
    5     9        VERIFY_RETURN_TYPE                                           !3
         10      > RETURN                                                       !3
    6    11*       VERIFY_RETURN_TYPE                                           
         12*     > RETURN                                                       null

End of function calculatetotal

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
129.34 ms | 486 KiB | 10 Q