3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); //the only right example var_dump( bcadd('17.123', '19.456', 10) ); //can't do this (changes are only in the first part), just all the cases that are inappropriate for bcmath //whitespace var_dump( bcadd('17 .123', '19.456', 10) ); //comma var_dump( bcadd('17,123', '19.456', 10) ); //comma as thousands separator var_dump( bcadd('1,700.123', '19.456', 10) ); //changing locale to a country which uses decimal comma, see this https://bugs.php.net/bug.php?id=55160 $currentLocale = setlocale(LC_ALL, 0); setlocale(LC_ALL, "en_DK.UTF-8"); var_dump( bcadd('1,700.123', '19.456', 10) ); setlocale(LC_ALL, $currentLocale); //exponential numbers var_dump( bcadd('17e123', '19.456', 10) ); //using words var_dump( bcadd('hello', '19.456', 10) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/D3s7J
function name:  (null)
number of ops:  70
compiled vars:  !0 = $currentLocale
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_FCALL                                               'var_dump'
    7     1        INIT_FCALL_BY_NAME                                       'bcadd'
          2        SEND_VAL_EX                                              '17.123'
          3        SEND_VAL_EX                                              '19.456'
          4        SEND_VAL_EX                                              10
          5        DO_FCALL                                      0  $1      
          6        SEND_VAR                                                 $1
    6     7        DO_ICALL                                                 
   12     8        INIT_FCALL                                               'var_dump'
   13     9        INIT_FCALL_BY_NAME                                       'bcadd'
         10        SEND_VAL_EX                                              '17+.123'
         11        SEND_VAL_EX                                              '19.456'
         12        SEND_VAL_EX                                              10
         13        DO_FCALL                                      0  $3      
         14        SEND_VAR                                                 $3
   12    15        DO_ICALL                                                 
   16    16        INIT_FCALL                                               'var_dump'
   17    17        INIT_FCALL_BY_NAME                                       'bcadd'
         18        SEND_VAL_EX                                              '17%2C123'
         19        SEND_VAL_EX                                              '19.456'
         20        SEND_VAL_EX                                              10
         21        DO_FCALL                                      0  $5      
         22        SEND_VAR                                                 $5
   16    23        DO_ICALL                                                 
   20    24        INIT_FCALL                                               'var_dump'
   21    25        INIT_FCALL_BY_NAME                                       'bcadd'
         26        SEND_VAL_EX                                              '1%2C700.123'
         27        SEND_VAL_EX                                              '19.456'
         28        SEND_VAL_EX                                              10
         29        DO_FCALL                                      0  $7      
         30        SEND_VAR                                                 $7
   20    31        DO_ICALL                                                 
   25    32        INIT_FCALL                                               'setlocale'
         33        SEND_VAL                                                 6
         34        SEND_VAL                                                 0
         35        DO_ICALL                                         $9      
         36        ASSIGN                                                   !0, $9
   26    37        INIT_FCALL                                               'setlocale'
         38        SEND_VAL                                                 6
         39        SEND_VAL                                                 'en_DK.UTF-8'
         40        DO_ICALL                                                 
   27    41        INIT_FCALL                                               'var_dump'
   28    42        INIT_FCALL_BY_NAME                                       'bcadd'
         43        SEND_VAL_EX                                              '1%2C700.123'
         44        SEND_VAL_EX                                              '19.456'
         45        SEND_VAL_EX                                              10
         46        DO_FCALL                                      0  $12     
         47        SEND_VAR                                                 $12
   27    48        DO_ICALL                                                 
   30    49        INIT_FCALL                                               'setlocale'
         50        SEND_VAL                                                 6
         51        SEND_VAR                                                 !0
         52        DO_ICALL                                                 
   33    53        INIT_FCALL                                               'var_dump'
   34    54        INIT_FCALL_BY_NAME                                       'bcadd'
         55        SEND_VAL_EX                                              '17e123'
         56        SEND_VAL_EX                                              '19.456'
         57        SEND_VAL_EX                                              10
         58        DO_FCALL                                      0  $15     
         59        SEND_VAR                                                 $15
   33    60        DO_ICALL                                                 
   38    61        INIT_FCALL                                               'var_dump'
   39    62        INIT_FCALL_BY_NAME                                       'bcadd'
         63        SEND_VAL_EX                                              'hello'
         64        SEND_VAL_EX                                              '19.456'
         65        SEND_VAL_EX                                              10
         66        DO_FCALL                                      0  $17     
         67        SEND_VAR                                                 $17
   38    68        DO_ICALL                                                 
   40    69      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.17 ms | 1073 KiB | 15 Q