3v4l.org

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

Function float_strval:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 28
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 21
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/4ZmTE
function name:  float_strval
number of ops:  32
compiled vars:  !0 = $fltValue, !1 = $strValue, !2 = $captures
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%28%5B%5C%2B%5C-%5D%29%28%5Cd%2B%29%24%2F'
          5        SEND_VAR                                                 !1
          6        SEND_REF                                                 !2
          7        DO_ICALL                                         $5      
          8      > JMPZ                                                     $5, ->28
    6     9    >   FETCH_DIM_R                                      ~6      !2, 1
         10        IS_IDENTICAL                                             ~6, '-'
         11      > JMPZ                                                     ~7, ->21
    7    12    >   INIT_FCALL                                               'number_format'
         13        SEND_VAR                                                 !0
         14        FETCH_DIM_R                                      ~8      !2, 2
         15        SEND_VAL                                                 ~8
         16        SEND_VAL                                                 '.'
         17        SEND_VAL                                                 ''
         18        DO_ICALL                                         $9      
         19        ASSIGN                                                   !1, $9
         20      > JMP                                                      ->28
    9    21    >   INIT_FCALL                                               'number_format'
         22        SEND_VAR                                                 !0
         23        SEND_VAL                                                 0
         24        SEND_VAL                                                 '.'
         25        SEND_VAL                                                 ''
         26        DO_ICALL                                         $11     
         27        ASSIGN                                                   !1, $11
   12    28    >   INIT_ARRAY                                       ~13     !0
         29        ADD_ARRAY_ELEMENT                                ~13     !1
         30      > RETURN                                                   ~13
   13    31*     > RETURN                                                   null

End of function float_strval

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
187.19 ms | 1403 KiB | 21 Q