3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tax = bcmul("33.95", ".065", 3); // 2.20675 $real_total = bcadd("33.95", "7.87", 3); // 41.82 $real_total = bcadd($real_total, $tax, 3); // 44.02675 echo bcround($real_total, 2); function bcround($number, $scale = 0) { $fix = "5"; for ($i=0; $i<$scale; $i++) $fix = "0$fix"; $number = bcadd($number, "0.$fix", $scale + 1); return bcdiv($number, "1.0", $scale); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gV0AG
function name:  (null)
number of ops:  24
compiled vars:  !0 = $tax, !1 = $real_total
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL_BY_NAME                                       'bcmul'
          1        SEND_VAL_EX                                              '33.95'
          2        SEND_VAL_EX                                              '.065'
          3        SEND_VAL_EX                                              3
          4        DO_FCALL                                      0  $2      
          5        ASSIGN                                                   !0, $2
    3     6        INIT_FCALL_BY_NAME                                       'bcadd'
          7        SEND_VAL_EX                                              '33.95'
          8        SEND_VAL_EX                                              '7.87'
          9        SEND_VAL_EX                                              3
         10        DO_FCALL                                      0  $4      
         11        ASSIGN                                                   !1, $4
    4    12        INIT_FCALL_BY_NAME                                       'bcadd'
         13        SEND_VAR_EX                                              !1
         14        SEND_VAR_EX                                              !0
         15        SEND_VAL_EX                                              3
         16        DO_FCALL                                      0  $6      
         17        ASSIGN                                                   !1, $6
    6    18        INIT_FCALL_BY_NAME                                       'bcround'
         19        SEND_VAR_EX                                              !1
         20        SEND_VAL_EX                                              2
         21        DO_FCALL                                      0  $8      
         22        ECHO                                                     $8
   12    23      > RETURN                                                   1

Function bcround:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 5
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 5
Branch analysis from position: 11
Branch analysis from position: 5
filename:       /in/gV0AG
function name:  bcround
number of ops:  27
compiled vars:  !0 = $number, !1 = $scale, !2 = $fix, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      0
    8     2        ASSIGN                                                   !2, '5'
    9     3        ASSIGN                                                   !3, 0
          4      > JMP                                                      ->9
          5    >   NOP                                                      
          6        FAST_CONCAT                                      ~6      '0', !2
          7        ASSIGN                                                   !2, ~6
          8        PRE_INC                                                  !3
          9    >   IS_SMALLER                                               !3, !1
         10      > JMPNZ                                                    ~9, ->5
   10    11    >   INIT_FCALL_BY_NAME                                       'bcadd'
         12        SEND_VAR_EX                                              !0
         13        NOP                                                      
         14        FAST_CONCAT                                      ~10     '0.', !2
         15        SEND_VAL_EX                                              ~10
         16        ADD                                              ~11     !1, 1
         17        SEND_VAL_EX                                              ~11
         18        DO_FCALL                                      0  $12     
         19        ASSIGN                                                   !0, $12
   11    20        INIT_FCALL_BY_NAME                                       'bcdiv'
         21        SEND_VAR_EX                                              !0
         22        SEND_VAL_EX                                              '1.0'
         23        SEND_VAR_EX                                              !1
         24        DO_FCALL                                      0  $14     
         25      > RETURN                                                   $14
   12    26*     > RETURN                                                   null

End of function bcround

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.68 ms | 1391 KiB | 22 Q