3v4l.org

run code in 500+ PHP versions simultaneously
<?php function randomFloat($min = 0, $max = 1) { return number_format($min + mt_rand() / mt_getrandmax() * ($max - $min), 2, '.', ''); // 2 decimal places } echo randomFloat(1,2);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5a5U1
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                                   'randomfloat'
          1        SEND_VAL                                                     1
          2        SEND_VAL                                                     2
          3        DO_FCALL                                          0  $0      
          4        ECHO                                                         $0
          5      > RETURN                                                       1

Function randomfloat:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5a5U1
function name:  randomFloat
number of ops:  18
compiled vars:  !0 = $min, !1 = $max
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV_INIT                                            !0      0
          1        RECV_INIT                                            !1      1
    4     2        INIT_FCALL                                                   'number_format'
          3        INIT_FCALL                                                   'mt_rand'
          4        DO_ICALL                                             $2      
          5        INIT_FCALL                                                   'mt_getrandmax'
          6        DO_ICALL                                             $3      
          7        DIV                                                  ~4      $2, $3
          8        SUB                                                  ~5      !1, !0
          9        MUL                                                  ~6      ~4, ~5
         10        ADD                                                  ~7      !0, ~6
         11        SEND_VAL                                                     ~7
         12        SEND_VAL                                                     2
         13        SEND_VAL                                                     '.'
         14        SEND_VAL                                                     ''
         15        DO_ICALL                                             $8      
         16      > RETURN                                                       $8
    5    17*     > RETURN                                                       null

End of function randomfloat

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.46 ms | 2077 KiB | 17 Q