3v4l.org

run code in 500+ PHP versions simultaneously
<?php $input = new \NumberFormatter('lv', \NumberFormatter::DECIMAL); $input->setAttribute($input::FRACTION_DIGITS, 2); //applies rounding during format $output = new \NumberFormatter('en', \NumberFormatter::DECIMAL); $output->setAttribute($output::FRACTION_DIGITS, 2); //applies rounding during format foreach (['5,77', '5,20', '5,2', '5,00', '5', '0'] as $value) { echo 'initial value: '; var_dump($value); $parsed = $input->parse($value); echo 'input::parse: '; var_dump($parsed); echo 'output::format: '; var_dump($output->format($parsed)); echo 'input::format: '; var_dump($input->format($parsed)); echo PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 54
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 54
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 54
filename:       /in/HRnQN
function name:  (null)
number of ops:  56
compiled vars:  !0 = $input, !1 = $output, !2 = $value, !3 = $parsed
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   NEW                                                  $4      'NumberFormatter'
          1        SEND_VAL_EX                                                  'lv'
          2        FETCH_CLASS_CONSTANT                                 ~5      'NumberFormatter', 'DECIMAL'
          3        SEND_VAL_EX                                                  ~5
          4        DO_FCALL                                          0          
          5        ASSIGN                                                       !0, $4
    4     6        INIT_METHOD_CALL                                             !0, 'setAttribute'
          7        FETCH_CLASS                                       0  $8      !0
          8        FETCH_CLASS_CONSTANT                                 ~9      $8, 'FRACTION_DIGITS'
          9        SEND_VAL_EX                                                  ~9
         10        SEND_VAL_EX                                                  2
         11        DO_FCALL                                          0          
    6    12        NEW                                                  $11     'NumberFormatter'
         13        SEND_VAL_EX                                                  'en'
         14        FETCH_CLASS_CONSTANT                                 ~12     'NumberFormatter', 'DECIMAL'
         15        SEND_VAL_EX                                                  ~12
         16        DO_FCALL                                          0          
         17        ASSIGN                                                       !1, $11
    7    18        INIT_METHOD_CALL                                             !1, 'setAttribute'
         19        FETCH_CLASS                                       0  $15     !1
         20        FETCH_CLASS_CONSTANT                                 ~16     $15, 'FRACTION_DIGITS'
         21        SEND_VAL_EX                                                  ~16
         22        SEND_VAL_EX                                                  2
         23        DO_FCALL                                          0          
    9    24      > FE_RESET_R                                           $18     <array>, ->54
         25    > > FE_FETCH_R                                                   $18, !2, ->54
   10    26    >   ECHO                                                         'initial+value%3A+'
   11    27        INIT_FCALL                                                   'var_dump'
         28        SEND_VAR                                                     !2
         29        DO_ICALL                                                     
   12    30        INIT_METHOD_CALL                                             !0, 'parse'
         31        SEND_VAR_EX                                                  !2
         32        DO_FCALL                                          0  $20     
         33        ASSIGN                                                       !3, $20
   13    34        ECHO                                                         'input%3A%3Aparse%3A+'
   14    35        INIT_FCALL                                                   'var_dump'
         36        SEND_VAR                                                     !3
         37        DO_ICALL                                                     
   15    38        ECHO                                                         'output%3A%3Aformat%3A+'
   16    39        INIT_FCALL                                                   'var_dump'
         40        INIT_METHOD_CALL                                             !1, 'format'
         41        SEND_VAR_EX                                                  !3
         42        DO_FCALL                                          0  $23     
         43        SEND_VAR                                                     $23
         44        DO_ICALL                                                     
   17    45        ECHO                                                         'input%3A%3Aformat%3A+'
   18    46        INIT_FCALL                                                   'var_dump'
         47        INIT_METHOD_CALL                                             !0, 'format'
         48        SEND_VAR_EX                                                  !3
         49        DO_FCALL                                          0  $25     
         50        SEND_VAR                                                     $25
         51        DO_ICALL                                                     
   19    52        ECHO                                                         '%0A'
    9    53      > JMP                                                          ->25
         54    >   FE_FREE                                                      $18
   20    55      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.43 ms | 2315 KiB | 14 Q