3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo var_export(20 / 3, true) . "\n"; echo var_export(6.66, true) . "\n"; echo var_export(6.0, true) . "\n"; echo "\n"; function format($f) { $p = (int) ini_get('precision'); $out = var_export(round($f, $p)); if (($pos = str_pos('.', $out)) !== FALSE && strlen($out) - $pos > $p) { } } $p = (int) ini_get('precision'); echo var_export((float)(string)round(20 / 3, $p)) . "\n"; echo var_export((float)(string)round(6.66, $p)) . "\n"; echo var_export((float)(string)round(6.0, $p)) . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b12rZ
function name:  (null)
number of ops:  58
compiled vars:  !0 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'var_export'
          1        SEND_VAL                                                 6.66667
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $1      
          4        CONCAT                                           ~2      $1, '%0A'
          5        ECHO                                                     ~2
    3     6        INIT_FCALL                                               'var_export'
          7        SEND_VAL                                                 6.66
          8        SEND_VAL                                                 <true>
          9        DO_ICALL                                         $3      
         10        CONCAT                                           ~4      $3, '%0A'
         11        ECHO                                                     ~4
    4    12        INIT_FCALL                                               'var_export'
         13        SEND_VAL                                                 6
         14        SEND_VAL                                                 <true>
         15        DO_ICALL                                         $5      
         16        CONCAT                                           ~6      $5, '%0A'
         17        ECHO                                                     ~6
    6    18        ECHO                                                     '%0A'
   16    19        INIT_FCALL                                               'ini_get'
         20        SEND_VAL                                                 'precision'
         21        DO_ICALL                                         $7      
         22        CAST                                          4  ~8      $7
         23        ASSIGN                                                   !0, ~8
   17    24        INIT_FCALL                                               'var_export'
         25        INIT_FCALL                                               'round'
         26        SEND_VAL                                                 6.66667
         27        SEND_VAR                                                 !0
         28        DO_ICALL                                         $10     
         29        CAST                                          6  ~11     $10
         30        CAST                                          5  ~12     ~11
         31        SEND_VAL                                                 ~12
         32        DO_ICALL                                         $13     
         33        CONCAT                                           ~14     $13, '%0A'
         34        ECHO                                                     ~14
   18    35        INIT_FCALL                                               'var_export'
         36        INIT_FCALL                                               'round'
         37        SEND_VAL                                                 6.66
         38        SEND_VAR                                                 !0
         39        DO_ICALL                                         $15     
         40        CAST                                          6  ~16     $15
         41        CAST                                          5  ~17     ~16
         42        SEND_VAL                                                 ~17
         43        DO_ICALL                                         $18     
         44        CONCAT                                           ~19     $18, '%0A'
         45        ECHO                                                     ~19
   19    46        INIT_FCALL                                               'var_export'
         47        INIT_FCALL                                               'round'
         48        SEND_VAL                                                 6
         49        SEND_VAR                                                 !0
         50        DO_ICALL                                         $20     
         51        CAST                                          6  ~21     $20
         52        CAST                                          5  ~22     ~21
         53        SEND_VAL                                                 ~22
         54        DO_ICALL                                         $23     
         55        CONCAT                                           ~24     $23, '%0A'
         56        ECHO                                                     ~24
         57      > RETURN                                                   1

Function format:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 21, Position 2 = 25
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 26
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
Branch analysis from position: 25
filename:       /in/b12rZ
function name:  format
number of ops:  27
compiled vars:  !0 = $f, !1 = $p, !2 = $out, !3 = $pos
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        INIT_FCALL                                               'ini_get'
          2        SEND_VAL                                                 'precision'
          3        DO_ICALL                                         $4      
          4        CAST                                          4  ~5      $4
          5        ASSIGN                                                   !1, ~5
   10     6        INIT_FCALL                                               'var_export'
          7        INIT_FCALL                                               'round'
          8        SEND_VAR                                                 !0
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $7      
         11        SEND_VAR                                                 $7
         12        DO_ICALL                                         $8      
         13        ASSIGN                                                   !2, $8
   11    14        INIT_FCALL_BY_NAME                                       'str_pos'
         15        SEND_VAL_EX                                              '.'
         16        SEND_VAR_EX                                              !2
         17        DO_FCALL                                      0  $10     
         18        ASSIGN                                           ~11     !3, $10
         19        TYPE_CHECK                                  1018  ~12     ~11
         20      > JMPZ_EX                                          ~12     ~12, ->25
         21    >   STRLEN                                           ~13     !2
         22        SUB                                              ~14     ~13, !3
         23        IS_SMALLER                                       ~15     !1, ~14
         24        BOOL                                             ~12     ~15
         25    > > JMPZ                                                     ~12, ->26
   14    26    > > RETURN                                                   null

End of function format

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.23 ms | 1400 KiB | 19 Q