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(round(20 / 3, $p)) . "\n"; echo var_export(round(6.66, $p)) . "\n"; echo var_export(round(6.0, $p)) . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n4IpX
function name:  (null)
number of ops:  52
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        SEND_VAR                                                 $10
         30        DO_ICALL                                         $11     
         31        CONCAT                                           ~12     $11, '%0A'
         32        ECHO                                                     ~12
   18    33        INIT_FCALL                                               'var_export'
         34        INIT_FCALL                                               'round'
         35        SEND_VAL                                                 6.66
         36        SEND_VAR                                                 !0
         37        DO_ICALL                                         $13     
         38        SEND_VAR                                                 $13
         39        DO_ICALL                                         $14     
         40        CONCAT                                           ~15     $14, '%0A'
         41        ECHO                                                     ~15
   19    42        INIT_FCALL                                               'var_export'
         43        INIT_FCALL                                               'round'
         44        SEND_VAL                                                 6
         45        SEND_VAR                                                 !0
         46        DO_ICALL                                         $16     
         47        SEND_VAR                                                 $16
         48        DO_ICALL                                         $17     
         49        CONCAT                                           ~18     $17, '%0A'
         50        ECHO                                                     ~18
         51      > 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/n4IpX
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:
153.68 ms | 1400 KiB | 19 Q