3v4l.org

run code in 300+ PHP versions simultaneously
<?php printf("PHP_VERSION=%s\n",PHP_VERSION); $min = -(mt_getrandmax()>>1); $max = mt_getrandmax(); $count = isset($argv[1])?(int)$argv[1]:16; printf("min=%d, max=%d, count=%d\n",$min,$max,$count); $repeat_counts = array(); for ($i=0;$i<$count;$i++) { $random = mt_rand($min,$max); if (!isset($repeat_counts[$random])) { $repeat_counts[$random] = 0; } $repeat_counts[$random]++; //printf("%12d%s\n", abs($random),($random<0)?"-":""); } $max_repeat_count = max($repeat_counts); $same_value_max = array(); if ($max_repeat_count > 1) { foreach ($repeat_counts as $value => $repeat_count) { if ($repeat_count >= $max_repeat_count) { $same_value_max[] = $value; } } printf("The following number/s was/were repeated %d times (%s%%): %s\n" ,$max_repeat_count ,number_format(($max_repeat_count/$count)*100.0,1) ,implode(", ",$same_value_max) ); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 29
Branch analysis from position: 44
2 jumps found. (Code = 43) Position 1 = 51, Position 2 = 76
Branch analysis from position: 51
2 jumps found. (Code = 77) Position 1 = 52, Position 2 = 59
Branch analysis from position: 52
2 jumps found. (Code = 78) Position 1 = 53, Position 2 = 59
Branch analysis from position: 53
2 jumps found. (Code = 43) Position 1 = 56, Position 2 = 58
Branch analysis from position: 56
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
Branch analysis from position: 58
Branch analysis from position: 59
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 59
Branch analysis from position: 76
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 39
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 29
Branch analysis from position: 44
Branch analysis from position: 29
Branch analysis from position: 39
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
filename:       /in/anJ6F
function name:  (null)
number of ops:  77
compiled vars:  !0 = $min, !1 = $max, !2 = $count, !3 = $argv, !4 = $repeat_counts, !5 = $i, !6 = $random, !7 = $max_repeat_count, !8 = $same_value_max, !9 = $repeat_count, !10 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'printf'
          1        SEND_VAL                                                 'PHP_VERSION%3D%25s%0A'
          2        SEND_VAL                                                 '8.3.0'
          3        DO_ICALL                                                 
    4     4        INIT_FCALL                                               'mt_getrandmax'
          5        DO_ICALL                                         $12     
          6        SR                                               ~13     $12, 1
          7        MUL                                              ~14     ~13, -1
          8        ASSIGN                                                   !0, ~14
    5     9        INIT_FCALL                                               'mt_getrandmax'
         10        DO_ICALL                                         $16     
         11        ASSIGN                                                   !1, $16
    6    12        ISSET_ISEMPTY_DIM_OBJ                         0          !3, 1
         13      > JMPZ                                                     ~18, ->18
         14    >   FETCH_DIM_R                                      ~19     !3, 1
         15        CAST                                          4  ~20     ~19
         16        QM_ASSIGN                                        ~21     ~20
         17      > JMP                                                      ->19
         18    >   QM_ASSIGN                                        ~21     16
         19    >   ASSIGN                                                   !2, ~21
    7    20        INIT_FCALL                                               'printf'
         21        SEND_VAL                                                 'min%3D%25d%2C+max%3D%25d%2C+count%3D%25d%0A'
         22        SEND_VAR                                                 !0
         23        SEND_VAR                                                 !1
         24        SEND_VAR                                                 !2
         25        DO_ICALL                                                 
    9    26        ASSIGN                                                   !4, <array>
   11    27        ASSIGN                                                   !5, 0
         28      > JMP                                                      ->42
   12    29    >   INIT_FCALL                                               'mt_rand'
         30        SEND_VAR                                                 !0
         31        SEND_VAR                                                 !1
         32        DO_ICALL                                         $26     
         33        ASSIGN                                                   !6, $26
   13    34        ISSET_ISEMPTY_DIM_OBJ                         0  ~28     !4, !6
         35        BOOL_NOT                                         ~29     ~28
         36      > JMPZ                                                     ~29, ->39
   14    37    >   ASSIGN_DIM                                               !4, !6
         38        OP_DATA                                                  0
   16    39    >   FETCH_DIM_RW                                     $31     !4, !6
         40        PRE_INC                                                  $31
   11    41        PRE_INC                                                  !5
         42    >   IS_SMALLER                                               !5, !2
         43      > JMPNZ                                                    ~34, ->29
   20    44    >   INIT_FCALL                                               'max'
         45        SEND_VAR                                                 !4
         46        DO_ICALL                                         $35     
         47        ASSIGN                                                   !7, $35
   21    48        ASSIGN                                                   !8, <array>
   22    49        IS_SMALLER                                               1, !7
         50      > JMPZ                                                     ~38, ->76
   23    51    > > FE_RESET_R                                       $39     !4, ->59
         52    > > FE_FETCH_R                                       ~40     $39, !9, ->59
         53    >   ASSIGN                                                   !10, ~40
   24    54        IS_SMALLER_OR_EQUAL                                      !7, !9
         55      > JMPZ                                                     ~42, ->58
   25    56    >   ASSIGN_DIM                                               !8
         57        OP_DATA                                                  !10
   23    58    > > JMP                                                      ->52
         59    >   FE_FREE                                                  $39
   28    60        INIT_FCALL                                               'printf'
         61        SEND_VAL                                                 'The+following+number%2Fs+was%2Fwere+repeated+%25d+times+%28%25s%25%25%29%3A+%25s%0A'
   29    62        SEND_VAR                                                 !7
   30    63        INIT_FCALL                                               'number_format'
         64        DIV                                              ~44     !7, !2
         65        MUL                                              ~45     ~44, 100
         66        SEND_VAL                                                 ~45
         67        SEND_VAL                                                 1
         68        DO_ICALL                                         $46     
         69        SEND_VAR                                                 $46
   31    70        INIT_FCALL                                               'implode'
         71        SEND_VAL                                                 '%2C+'
         72        SEND_VAR                                                 !8
         73        DO_ICALL                                         $47     
         74        SEND_VAR                                                 $47
   28    75        DO_ICALL                                                 
   33    76    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.14 ms | 1012 KiB | 19 Q