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(); } usort($arr, function($a,$b){return $b<=>$a;}); // 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/qn7Ka
function name:  (null)
number of ops:  19
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                                               'usort'
         11        SEND_REF                                                 !0
         12        DECLARE_LAMBDA_FUNCTION                          ~8      [0]
         13        SEND_VAL                                                 ~8
         14        DO_ICALL                                                 
   15    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                                 
         18      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qn7Ka
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        SPACESHIP                                        ~2      !1, !0
          3      > RETURN                                                   ~2
          4*     > RETURN                                                   null

End of Dynamic Function 0

Function random_from_0_to_1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qn7Ka
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:
139.83 ms | 1008 KiB | 18 Q