3v4l.org

run code in 300+ PHP versions simultaneously
<?php $base = 100000; $purchaseprice = 150000; $basefee = 4600; $addfee = 700; $addincrement = 50000; $tempprice = max($purchaseprice - $base, 0); $increments = ( $tempprice > 0 ? intdiv($tempprice, $addincrement) : 0); if($purchaseprice % $addincrement == 0) { $increments++; } $finalprice = $purchaseprice + $basefee + ($increments * $addfee); print "Purchase price: {$purchaseprice}, Base Fee: {$basefee}, Increments: {$increments} x {$addfee}, Final Price: {$finalprice}"; ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 19
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 25
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 25
Branch analysis from position: 24
Branch analysis from position: 25
filename:       /in/ilRVo
function name:  (null)
number of ops:  41
compiled vars:  !0 = $base, !1 = $purchaseprice, !2 = $basefee, !3 = $addfee, !4 = $addincrement, !5 = $tempprice, !6 = $increments, !7 = $finalprice
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 100000
    3     1        ASSIGN                                                   !1, 150000
    4     2        ASSIGN                                                   !2, 4600
    5     3        ASSIGN                                                   !3, 700
    6     4        ASSIGN                                                   !4, 50000
    8     5        INIT_FCALL                                               'max'
          6        SUB                                              ~13     !1, !0
          7        SEND_VAL                                                 ~13
          8        SEND_VAL                                                 0
          9        DO_ICALL                                         $14     
         10        ASSIGN                                                   !5, $14
    9    11        IS_SMALLER                                               0, !5
         12      > JMPZ                                                     ~16, ->19
         13    >   INIT_FCALL                                               'intdiv'
         14        SEND_VAR                                                 !5
         15        SEND_VAR                                                 !4
         16        DO_ICALL                                         $17     
         17        QM_ASSIGN                                        ~18     $17
         18      > JMP                                                      ->20
         19    >   QM_ASSIGN                                        ~18     0
         20    >   ASSIGN                                                   !6, ~18
   10    21        MOD                                              ~20     !1, !4
         22        IS_EQUAL                                                 ~20, 0
         23      > JMPZ                                                     ~21, ->25
         24    >   PRE_INC                                                  !6
   12    25    >   ADD                                              ~23     !1, !2
         26        MUL                                              ~24     !6, !3
         27        ADD                                              ~25     ~23, ~24
         28        ASSIGN                                                   !7, ~25
   14    29        ROPE_INIT                                    10  ~28     'Purchase+price%3A+'
         30        ROPE_ADD                                      1  ~28     ~28, !1
         31        ROPE_ADD                                      2  ~28     ~28, '%2C+Base+Fee%3A+'
         32        ROPE_ADD                                      3  ~28     ~28, !2
         33        ROPE_ADD                                      4  ~28     ~28, '%2C+Increments%3A+'
         34        ROPE_ADD                                      5  ~28     ~28, !6
         35        ROPE_ADD                                      6  ~28     ~28, '+x+'
         36        ROPE_ADD                                      7  ~28     ~28, !3
         37        ROPE_ADD                                      8  ~28     ~28, '%2C+Final+Price%3A+'
         38        ROPE_END                                      9  ~27     ~28, !7
         39        ECHO                                                     ~27
   16    40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
130.96 ms | 1405 KiB | 17 Q