3v4l.org

run code in 300+ PHP versions simultaneously
<?php function float_strval($fltValue) { $strValue = (string)$fltValue; if (preg_match("/E[\+\-]\d+$/", $strValue)) { $strValue = number_format($fltValue, 16, '.', ''); } $oldStrValue = number_format($fltValue, 16, '.', ''); return ['in'=>$fltValue, 'out'=>$strValue, 'old'=>$oldStrValue]; } print_r(float_strval(0.00000021)); print_r(float_strval(1209381092380198230.123)); print_r(float_strval(90.05));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ddBh0
function name:  (null)
number of ops:  19
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'print_r'
          1        INIT_FCALL                                               'float_strval'
          2        SEND_VAL                                                 2.1e-7
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
   12     6        INIT_FCALL                                               'print_r'
          7        INIT_FCALL                                               'float_strval'
          8        SEND_VAL                                                 1.20938e+18
          9        DO_FCALL                                      0  $2      
         10        SEND_VAR                                                 $2
         11        DO_ICALL                                                 
   13    12        INIT_FCALL                                               'print_r'
         13        INIT_FCALL                                               'float_strval'
         14        SEND_VAL                                                 90.05
         15        DO_FCALL                                      0  $4      
         16        SEND_VAR                                                 $4
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Function float_strval:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 15
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/ddBh0
function name:  float_strval
number of ops:  27
compiled vars:  !0 = $fltValue, !1 = $strValue, !2 = $oldStrValue
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        CAST                                          6  ~3      !0
          2        ASSIGN                                                   !1, ~3
    5     3        INIT_FCALL                                               'preg_match'
          4        SEND_VAL                                                 '%2FE%5B%5C%2B%5C-%5D%5Cd%2B%24%2F'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $5      
          7      > JMPZ                                                     $5, ->15
    6     8    >   INIT_FCALL                                               'number_format'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 16
         11        SEND_VAL                                                 '.'
         12        SEND_VAL                                                 ''
         13        DO_ICALL                                         $6      
         14        ASSIGN                                                   !1, $6
    8    15    >   INIT_FCALL                                               'number_format'
         16        SEND_VAR                                                 !0
         17        SEND_VAL                                                 16
         18        SEND_VAL                                                 '.'
         19        SEND_VAL                                                 ''
         20        DO_ICALL                                         $8      
         21        ASSIGN                                                   !2, $8
    9    22        INIT_ARRAY                                       ~10     !0, 'in'
         23        ADD_ARRAY_ELEMENT                                ~10     !1, 'out'
         24        ADD_ARRAY_ELEMENT                                ~10     !2, 'old'
         25      > RETURN                                                   ~10
   10    26*     > RETURN                                                   null

End of function float_strval

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.65 ms | 1403 KiB | 22 Q