3v4l.org

run code in 300+ PHP versions simultaneously
<?php function round_price_with_limits( $price = null, $multiplier = 9.3, $nearest = 10, $minus = 0.05, $map = 9.95, $msrp = 9999999999) { // Ensure a price was provided. if ( !empty( $price ) ) { // Calculate price with markup and round it. $rounded_price = ( ceil ( ( $price * $multiplier ) / $nearest ) * $nearest ) - $minus; // If price is less than minimum, return minimum. if($rounded_price < $map){ return $map; } // If price is greater than maximum, return maximum. elseif($rounded_price > $msrp){ return $msrp; } else { // Return price otherwise. return $rounded_price; } } } echo round_price_with_limits(1.76);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6bPr7
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   INIT_FCALL                                               'round_price_with_limits'
          1        SEND_VAL                                                 1.76
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function round_price_with_limits:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 26
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6bPr7
function name:  round_price_with_limits
number of ops:  27
compiled vars:  !0 = $price, !1 = $multiplier, !2 = $nearest, !3 = $minus, !4 = $map, !5 = $msrp, !6 = $rounded_price
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_INIT                                        !0      null
          1        RECV_INIT                                        !1      9.3
          2        RECV_INIT                                        !2      10
          3        RECV_INIT                                        !3      0.05
          4        RECV_INIT                                        !4      9.95
          5        RECV_INIT                                        !5      9999999999
    6     6        ISSET_ISEMPTY_CV                                 ~7      !0
          7        BOOL_NOT                                         ~8      ~7
          8      > JMPZ                                                     ~8, ->26
    9     9    >   INIT_FCALL                                               'ceil'
         10        MUL                                              ~9      !0, !1
         11        DIV                                              ~10     ~9, !2
         12        SEND_VAL                                                 ~10
         13        DO_ICALL                                         $11     
         14        MUL                                              ~12     !2, $11
         15        SUB                                              ~13     ~12, !3
         16        ASSIGN                                                   !6, ~13
   12    17        IS_SMALLER                                               !6, !4
         18      > JMPZ                                                     ~15, ->21
   14    19    > > RETURN                                                   !4
   12    20*       JMP                                                      ->26
   18    21    >   IS_SMALLER                                               !5, !6
         22      > JMPZ                                                     ~16, ->25
   20    23    > > RETURN                                                   !5
   18    24*       JMP                                                      ->26
   25    25    > > RETURN                                                   !6
   30    26    > > RETURN                                                   null

End of function round_price_with_limits

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
219.19 ms | 1013 KiB | 15 Q