3v4l.org

run code in 300+ PHP versions simultaneously
<?php $float = 0.0000000038; echo "float: $float\n"; $str = (string)$float; echo "string: $str\n"; $n_dec = strlen(substr(strrchr($str, '.'), 1)); echo "$n_dec\n"; echo number_format($float, $n_dec), "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nW0HI
function name:  (null)
number of ops:  31
compiled vars:  !0 = $float, !1 = $str, !2 = $n_dec
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 3.8e-9
    4     1        ROPE_INIT                                     3  ~5      'float%3A+'
          2        ROPE_ADD                                      1  ~5      ~5, !0
          3        ROPE_END                                      2  ~4      ~5, '%0A'
          4        ECHO                                                     ~4
    5     5        CAST                                          6  ~7      !0
          6        ASSIGN                                                   !1, ~7
    6     7        ROPE_INIT                                     3  ~10     'string%3A+'
          8        ROPE_ADD                                      1  ~10     ~10, !1
          9        ROPE_END                                      2  ~9      ~10, '%0A'
         10        ECHO                                                     ~9
    8    11        INIT_FCALL                                               'substr'
         12        INIT_FCALL                                               'strrchr'
         13        SEND_VAR                                                 !1
         14        SEND_VAL                                                 '.'
         15        DO_ICALL                                         $12     
         16        SEND_VAR                                                 $12
         17        SEND_VAL                                                 1
         18        DO_ICALL                                         $13     
         19        STRLEN                                           ~14     $13
         20        ASSIGN                                                   !2, ~14
   10    21        NOP                                                      
         22        FAST_CONCAT                                      ~16     !2, '%0A'
         23        ECHO                                                     ~16
   12    24        INIT_FCALL                                               'number_format'
         25        SEND_VAR                                                 !0
         26        SEND_VAR                                                 !2
         27        DO_ICALL                                         $17     
         28        ECHO                                                     $17
         29        ECHO                                                     '%0A'
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.22 ms | 1395 KiB | 19 Q