3v4l.org

run code in 300+ PHP versions simultaneously
<?php function random_from_0_to_1() { return (float)rand() / (float)getrandmax(); } $arr = []; for ($i=0;$i<50;$i++) { $arr[] = random_from_0_to_1(); } sort($arr); // sorts ascending $arr = array_reverse($arr); var_dump($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 3
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 3
Branch analysis from position: 10
Branch analysis from position: 3
filename:       /in/NJvGu
function name:  (null)
number of ops:  21
compiled vars:  !0 = $arr, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->8
   10     3    >   INIT_FCALL                                               'random_from_0_to_1'
          4        DO_FCALL                                      0  $5      
          5        ASSIGN_DIM                                               !0
          6        OP_DATA                                                  $5
    9     7        PRE_INC                                                  !1
          8    >   IS_SMALLER                                               !1, 50
          9      > JMPNZ                                                    ~7, ->3
   12    10    >   INIT_FCALL                                               'sort'
         11        SEND_REF                                                 !0
         12        DO_ICALL                                                 
   13    13        INIT_FCALL                                               'array_reverse'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                         $9      
         16        ASSIGN                                                   !0, $9
   15    17        INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Function random_from_0_to_1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NJvGu
function name:  random_from_0_to_1
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'rand'
          1        DO_ICALL                                         $0      
          2        CAST                                          5  ~1      $0
          3        INIT_FCALL                                               'getrandmax'
          4        DO_ICALL                                         $2      
          5        CAST                                          5  ~3      $2
          6        DIV                                              ~4      ~1, ~3
          7      > RETURN                                                   ~4
    6     8*     > RETURN                                                   null

End of function random_from_0_to_1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.31 ms | 1005 KiB | 19 Q