3v4l.org

run code in 300+ PHP versions simultaneously
<?php function round_price_product( $price ){ // Return rounded price $parts = explode(".", $price); $parts[1] = round($parts[1]/10,0)*10; if($parts[1] == 100) { $parts[0]++; $parts[1] = 0; } return $parts[0] . "." . str_pad($parts[1], 2, 0, STR_PAD_RIGHT); } echo round_price_product("47.95");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/92sO1
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'round_price_product'
          1        SEND_VAL                                                 '47.95'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function round_price_product:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 22
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/92sO1
function name:  round_price_product
number of ops:  34
compiled vars:  !0 = $price, !1 = $parts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '.'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $2      
          5        ASSIGN                                                   !1, $2
    6     6        INIT_FCALL                                               'round'
          7        FETCH_DIM_R                                      ~5      !1, 1
          8        DIV                                              ~6      ~5, 10
          9        SEND_VAL                                                 ~6
         10        SEND_VAL                                                 0
         11        DO_ICALL                                         $7      
         12        MUL                                              ~8      $7, 10
         13        ASSIGN_DIM                                               !1, 1
         14        OP_DATA                                                  ~8
    7    15        FETCH_DIM_R                                      ~9      !1, 1
         16        IS_EQUAL                                                 ~9, 100
         17      > JMPZ                                                     ~10, ->22
    8    18    >   FETCH_DIM_RW                                     $11     !1, 0
         19        PRE_INC                                                  $11
    9    20        ASSIGN_DIM                                               !1, 1
         21        OP_DATA                                                  0
   11    22    >   FETCH_DIM_R                                      ~14     !1, 0
         23        CONCAT                                           ~15     ~14, '.'
         24        INIT_FCALL                                               'str_pad'
         25        FETCH_DIM_R                                      ~16     !1, 1
         26        SEND_VAL                                                 ~16
         27        SEND_VAL                                                 2
         28        SEND_VAL                                                 0
         29        SEND_VAL                                                 1
         30        DO_ICALL                                         $17     
         31        CONCAT                                           ~18     ~15, $17
         32      > RETURN                                                   ~18
   12    33*     > RETURN                                                   null

End of function round_price_product

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.02 ms | 1007 KiB | 17 Q