3v4l.org

run code in 300+ PHP versions simultaneously
<?php $numbers = array( 20/3, 20/3 * 1e6, 6.66, 6.0, 60.0, ); $p = (int) ini_get('precision'); foreach ($numbers as $n) { echo 'RAW: ' . $n . "\n"; echo 'EXP: ' . var_export($n, TRUE) . "\n"; echo 'FIX: ' . rtrim(rtrim(sprintf('%1.' . ($p - 1) . 'F', $n), '0'), '.') . "\n"; echo "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 38
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 38
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
filename:       /in/Hlf7n
function name:  (null)
number of ops:  40
compiled vars:  !0 = $numbers, !1 = $p, !2 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        INIT_FCALL                                               'ini_get'
          2        SEND_VAL                                                 'precision'
          3        DO_ICALL                                         $4      
          4        CAST                                          4  ~5      $4
          5        ASSIGN                                                   !1, ~5
   13     6      > FE_RESET_R                                       $7      !0, ->38
          7    > > FE_FETCH_R                                               $7, !2, ->38
   14     8    >   CONCAT                                           ~8      'RAW%3A+', !2
          9        CONCAT                                           ~9      ~8, '%0A'
         10        ECHO                                                     ~9
   15    11        INIT_FCALL                                               'var_export'
         12        SEND_VAR                                                 !2
         13        SEND_VAL                                                 <true>
         14        DO_ICALL                                         $10     
         15        CONCAT                                           ~11     'EXP%3A+', $10
         16        CONCAT                                           ~12     ~11, '%0A'
         17        ECHO                                                     ~12
   16    18        INIT_FCALL                                               'rtrim'
         19        INIT_FCALL                                               'rtrim'
         20        INIT_FCALL                                               'sprintf'
         21        SUB                                              ~13     !1, 1
         22        CONCAT                                           ~14     '%251.', ~13
         23        CONCAT                                           ~15     ~14, 'F'
         24        SEND_VAL                                                 ~15
         25        SEND_VAR                                                 !2
         26        DO_ICALL                                         $16     
         27        SEND_VAR                                                 $16
         28        SEND_VAL                                                 '0'
         29        DO_ICALL                                         $17     
         30        SEND_VAR                                                 $17
         31        SEND_VAL                                                 '.'
         32        DO_ICALL                                         $18     
         33        CONCAT                                           ~19     'FIX%3A+', $18
         34        CONCAT                                           ~20     ~19, '%0A'
         35        ECHO                                                     ~20
   17    36        ECHO                                                     '%0A'
   13    37      > JMP                                                      ->7
         38    >   FE_FREE                                                  $7
   18    39      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.13 ms | 1396 KiB | 21 Q