3v4l.org

run code in 300+ PHP versions simultaneously
<?php function round_up($val) { return ceil(bcdiv(bcmul($val, 100, 2)), 100, 2); } $a = 5.4; $b = 48; var_dump($a * $b); var_dump(bcmul($a, $b, 2) * 1); var_dump(round_up($a * $b)); var_dump(round_up(bcmul($a, $b, 2))); echo "\n"; $a = 5.4; $b = 48.13; var_dump($a * $b); var_dump(bcmul($a, $b, 2) * 1); var_dump(round_up($a * $b)); var_dump(round_up(bcmul($a, $b, 2))); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dW7eh
function name:  (null)
number of ops:  68
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, 5.4
    9     1        ASSIGN                                                   !1, 48
   10     2        INIT_FCALL                                               'var_dump'
          3        MUL                                              ~4      !0, !1
          4        SEND_VAL                                                 ~4
          5        DO_ICALL                                                 
   11     6        INIT_FCALL                                               'var_dump'
          7        INIT_FCALL_BY_NAME                                       'bcmul'
          8        SEND_VAR_EX                                              !0
          9        SEND_VAR_EX                                              !1
         10        SEND_VAL_EX                                              2
         11        DO_FCALL                                      0  $6      
         12        MUL                                              ~7      $6, 1
         13        SEND_VAL                                                 ~7
         14        DO_ICALL                                                 
   12    15        INIT_FCALL                                               'var_dump'
         16        INIT_FCALL                                               'round_up'
         17        MUL                                              ~9      !0, !1
         18        SEND_VAL                                                 ~9
         19        DO_FCALL                                      0  $10     
         20        SEND_VAR                                                 $10
         21        DO_ICALL                                                 
   13    22        INIT_FCALL                                               'var_dump'
         23        INIT_FCALL                                               'round_up'
         24        INIT_FCALL_BY_NAME                                       'bcmul'
         25        SEND_VAR_EX                                              !0
         26        SEND_VAR_EX                                              !1
         27        SEND_VAL_EX                                              2
         28        DO_FCALL                                      0  $12     
         29        SEND_VAR                                                 $12
         30        DO_FCALL                                      0  $13     
         31        SEND_VAR                                                 $13
         32        DO_ICALL                                                 
   14    33        ECHO                                                     '%0A'
   15    34        ASSIGN                                                   !0, 5.4
   16    35        ASSIGN                                                   !1, 48.13
   17    36        INIT_FCALL                                               'var_dump'
         37        MUL                                              ~17     !0, !1
         38        SEND_VAL                                                 ~17
         39        DO_ICALL                                                 
   18    40        INIT_FCALL                                               'var_dump'
         41        INIT_FCALL_BY_NAME                                       'bcmul'
         42        SEND_VAR_EX                                              !0
         43        SEND_VAR_EX                                              !1
         44        SEND_VAL_EX                                              2
         45        DO_FCALL                                      0  $19     
         46        MUL                                              ~20     $19, 1
         47        SEND_VAL                                                 ~20
         48        DO_ICALL                                                 
   19    49        INIT_FCALL                                               'var_dump'
         50        INIT_FCALL                                               'round_up'
         51        MUL                                              ~22     !0, !1
         52        SEND_VAL                                                 ~22
         53        DO_FCALL                                      0  $23     
         54        SEND_VAR                                                 $23
         55        DO_ICALL                                                 
   20    56        INIT_FCALL                                               'var_dump'
         57        INIT_FCALL                                               'round_up'
         58        INIT_FCALL_BY_NAME                                       'bcmul'
         59        SEND_VAR_EX                                              !0
         60        SEND_VAR_EX                                              !1
         61        SEND_VAL_EX                                              2
         62        DO_FCALL                                      0  $25     
         63        SEND_VAR                                                 $25
         64        DO_FCALL                                      0  $26     
         65        SEND_VAR                                                 $26
         66        DO_ICALL                                                 
   22    67      > RETURN                                                   1

Function round_up:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dW7eh
function name:  round_up
number of ops:  16
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'ceil'
          2        INIT_FCALL_BY_NAME                                       'bcdiv'
          3        INIT_FCALL_BY_NAME                                       'bcmul'
          4        SEND_VAR_EX                                              !0
          5        SEND_VAL_EX                                              100
          6        SEND_VAL_EX                                              2
          7        DO_FCALL                                      0  $1      
          8        SEND_VAR_NO_REF_EX                                       $1
          9        DO_FCALL                                      0  $2      
         10        SEND_VAR                                                 $2
         11        SEND_VAL                                                 100
         12        SEND_VAL                                                 2
         13        DO_ICALL                                         $3      
         14      > RETURN                                                   $3
    6    15*     > RETURN                                                   null

End of function round_up

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.81 ms | 1402 KiB | 21 Q