3v4l.org

run code in 300+ PHP versions simultaneously
<?php $existing = []; $repeat_numbers = []; for ($rnd=1;$rnd<=50;$rnd++) { $randoms[] = mt_rand(0,25); // see this block for generating randoms } $i = 0; echo implode('-',$randoms).PHP_EOL; foreach($randoms as $rnd){ $i++; if(in_array($rnd,$existing)){ $repeat_numbers[] = $i; $i=1; $existing = []; } $existing[] = $rnd; } echo implode('-',$repeat_numbers); ?>
Output for 7.3.7
12-6-23-8-14-0-21-23-16-19-19-9-6-3-17-8-24-21-20-25-10-4-5-3-24-24-6-22-3-20-19-12-0-1-4-21-14-12-7-5-16-25-22-2-1-2-3-18-20-17 8-4-14-3-13-9
Output for 7.3.6
10-23-10-18-14-11-5-1-8-10-15-17-25-25-0-17-4-1-19-18-18-18-20-24-24-16-11-14-15-25-14-8-9-2-3-24-20-25-17-25-8-21-10-11-0-20-15-5-25-3 3-8-5-8-2-4-7-10-10
Output for 7.3.5
4-24-15-9-12-1-11-23-14-0-0-2-3-12-22-18-4-20-14-15-10-11-22-1-2-12-14-21-15-9-13-22-4-3-7-17-6-18-21-9-19-21-15-12-23-16-12-8-8-4 11-13-10-11-6-3
Output for 7.3.4
24-17-20-13-8-9-5-20-0-21-8-15-9-13-16-3-23-11-3-6-25-12-19-23-12-22-3-3-12-1-20-20-15-15-0-4-17-24-2-11-23-2-11-19-13-23-7-1-13-22 8-12-7-4-5-3-9-8
Output for 7.3.3
23-20-22-20-20-14-18-4-1-10-24-24-21-0-8-14-17-10-11-11-2-13-19-20-15-23-12-19-24-14-19-16-12-8-4-2-18-5-8-25-25-15-20-23-24-12-5-9-24-15 4-2-8-9-9-4-9-3-9
Output for 7.3.2
15-16-2-5-23-7-4-11-9-9-5-24-21-5-18-0-8-8-18-3-20-8-2-5-18-18-23-15-20-13-23-12-1-15-22-17-2-11-12-15-5-16-25-8-15-10-2-17-4-11 10-5-5-5-5-6-9-7
Output for 7.3.1
1-4-15-11-23-24-24-2-21-19-20-8-20-4-0-25-1-14-25-11-4-24-19-25-24-11-0-6-22-18-8-3-24-1-7-10-24-18-15-3-24-2-20-11-22-6-5-4-1-10 7-7-7-6-10-5-5
Output for 7.3.0
17-19-15-22-22-4-7-23-19-17-16-16-11-22-7-4-2-12-25-3-0-14-16-12-10-22-16-14-13-2-8-3-18-10-4-17-24-15-10-17-24-21-5-20-10-15-3-20-7-8 5-8-12-5-13-7
Output for 7.2.20
12-22-25-21-17-21-17-25-4-8-17-4-18-20-2-4-8-16-8-10-9-21-7-20-24-21-0-11-24-25-18-11-0-24-19-1-9-18-15-15-0-25-25-6-10-10-21-2-3-21 6-6-6-4-8-7-9-4-4-5
Output for 7.2.19
8-5-5-11-13-9-23-21-17-13-14-16-16-18-23-16-20-0-21-19-2-21-9-23-13-13-8-5-3-24-18-6-9-3-19-23-1-0-9-19-10-8-25-22-2-20-20-15-17-21 3-8-4-4-7-5-9-7-8
Output for 7.2.18
18-16-5-15-10-14-9-20-8-20-14-11-8-2-10-21-17-13-4-21-19-3-16-25-24-21-5-13-5-12-11-21-15-7-19-21-0-11-8-13-11-19-21-4-2-15-12-14-21-2 10-11-7-4-8-6-9
Output for 7.2.17
7-16-17-5-15-4-3-22-6-1-19-9-14-5-24-8-14-12-16-5-17-23-2-10-5-24-24-19-11-22-23-8-2-0-1-4-13-23-15-16-3-10-3-13-11-23-2-7-19-14 14-7-6-3-12-6
Output for 7.2.16
20-0-7-14-17-19-22-2-14-21-23-24-10-2-1-6-5-19-25-9-23-3-18-15-4-3-4-1-10-8-8-21-25-1-19-18-11-11-18-20-18-17-9-7-19-20-14-10-16-2 9-13-6-6-8-4
Output for 7.2.15
18-0-4-0-10-6-14-21-3-4-2-7-11-14-6-3-1-18-12-2-5-23-23-19-17-6-19-24-8-4-18-10-22-20-25-25-25-4-2-15-18-21-7-7-13-24-19-13-2-3 4-11-10-5-10-2-8-5
Output for 7.2.14
10-24-10-24-3-23-22-14-11-7-3-13-13-24-1-22-22-14-8-21-19-23-14-0-5-14-23-15-13-11-18-21-7-24-3-5-5-6-0-21-9-14-8-23-19-20-20-21-7-6 3-9-3-5-7-4-12-11
Output for 7.2.13
20-0-1-7-22-12-0-23-21-10-12-11-7-10-18-8-8-5-18-21-4-5-17-2-7-2-0-14-9-1-14-11-10-3-2-21-8-25-1-24-18-4-18-12-18-1-24-23-15-8 7-8-4-6-5-6-13-3
Output for 7.2.12
1-3-24-11-20-1-2-18-11-18-21-23-20-23-17-19-0-18-2-22-23-6-12-11-0-25-11-17-24-4-6-4-19-21-14-10-5-19-9-23-10-15-11-13-10-18-7-3-19-23 6-5-5-8-7-6-7-8
Output for 7.2.11
0-6-21-23-10-2-1-20-2-16-22-3-13-4-2-25-24-14-9-10-8-16-19-15-11-3-18-7-0-24-15-1-10-9-18-12-6-11-7-10-2-11-11-17-15-1-17-1-12-23 9-7-16-11-4-5
Output for 7.2.10
12-22-6-14-18-6-21-0-17-2-8-1-8-13-20-5-2-22-21-7-3-10-6-2-17-15-16-21-4-19-16-0-24-18-6-22-21-19-9-20-20-19-17-25-11-20-17-22-3-9 6-8-12-8-11-6
Output for 7.2.9
8-18-23-16-5-17-0-8-13-2-17-12-20-12-1-10-5-13-7-25-24-23-12-9-8-19-9-16-10-0-3-7-17-19-9-2-25-18-18-11-12-1-14-12-16-7-14-12-11-7 8-7-10-5-9-5-6-5
Output for 7.2.8
17-20-5-24-6-4-14-24-16-11-24-21-5-7-13-6-8-12-1-17-13-24-24-14-4-24-9-17-13-23-17-6-20-9-0-5-18-22-20-17-18-8-5-4-4-16-17-16-15-0 8-4-11-3-4-6-9-7-4
Output for 7.2.7
16-24-23-14-7-19-23-24-4-25-15-24-6-23-15-25-7-9-15-22-19-20-23-13-10-24-4-21-17-8-21-14-3-2-1-22-10-7-17-23-18-13-11-17-8-13-8-12-23-12 7-6-8-13-14-4-4
Output for 7.2.6
12-7-0-17-25-5-16-10-25-23-8-4-0-8-21-16-20-8-22-5-14-8-3-3-13-19-20-15-8-4-4-21-15-5-13-17-20-14-8-15-17-9-14-10-16-22-21-7-18-21 9-6-5-5-3-8-10-11
Output for 7.2.5
3-11-16-15-13-0-7-20-25-9-17-10-25-9-8-21-13-1-19-10-4-19-20-8-25-3-3-9-11-22-22-5-7-9-24-11-5-13-12-13-10-21-24-0-12-1-22-2-22-11 13-10-6-5-7-4-10
Output for 7.2.4
23-7-21-16-23-9-11-3-20-19-24-3-2-16-14-22-22-19-20-18-8-9-8-16-6-15-9-17-16-10-6-1-8-25-24-20-8-24-15-7-17-17-7-23-21-2-25-20-3-2 5-8-6-7-7-9-6-9
Output for 7.2.3
17-13-5-8-8-4-22-13-11-19-22-1-18-21-16-14-16-16-5-20-7-24-14-14-19-13-12-18-0-10-6-12-10-7-17-10-15-18-11-15-23-4-17-10-21-2-11-7-11-1 5-7-7-2-7-9-5-5-10
Output for 7.2.2
7-9-18-24-24-15-5-14-13-24-14-19-6-15-0-15-7-13-1-5-24-12-13-10-7-2-15-24-10-24-6-22-1-3-21-12-23-7-18-13-1-16-18-17-17-16-23-0-1-14 5-6-7-8-7-13-5
Output for 7.2.1
15-3-24-15-25-22-22-12-5-9-22-22-15-25-15-16-23-14-16-6-21-23-14-17-16-22-23-15-23-10-19-16-24-5-24-5-24-7-11-10-21-8-9-2-6-4-25-25-3-13 4-4-5-2-4-5-7-5-7-3-12
Output for 7.2.0
3-10-7-19-7-18-16-0-7-1-19-25-11-5-18-24-8-0-21-2-5-11-20-0-16-13-16-23-18-2-22-13-4-13-17-2-3-10-16-13-12-21-22-21-14-7-4-4-5-17 5-5-13-7-8-7-5-5
Output for 7.1.30
18-22-20-5-15-21-9-0-1-4-23-3-0-6-24-2-18-14-8-13-15-2-3-3-20-7-22-4-20-7-2-8-6-1-19-6-13-22-17-14-24-3-12-2-8-17-25-5-9-12 13-10-3-6-8-11
Output for 7.1.29
7-8-1-7-4-15-14-17-20-18-20-25-21-14-11-25-5-0-9-9-23-22-9-3-24-25-7-1-7-8-17-6-0-17-13-24-2-4-24-2-13-14-19-15-24-17-14-11-4-13 4-8-6-5-4-7-6-6-7
Output for 7.1.28
14-16-5-20-11-5-8-8-11-21-20-11-10-13-20-1-22-3-25-13-13-5-3-2-23-24-22-9-3-22-17-20-13-19-6-16-25-0-2-15-0-5-21-15-12-17-22-17-18-9 6-3-5-9-2-9-13-8
Output for 7.1.27
19-13-25-23-21-25-14-11-3-3-25-3-5-2-18-14-22-6-0-1-4-18-20-3-1-13-17-11-11-9-18-6-15-11-4-4-20-12-16-23-23-0-6-8-19-14-10-14-14-3 6-5-3-11-8-6-3-6-8-2
Output for 7.1.26
11-22-10-11-15-24-0-20-6-15-24-12-15-20-7-16-10-13-18-19-3-21-6-12-4-20-3-25-25-18-7-15-14-1-22-12-0-20-21-19-23-17-16-13-20-22-8-19-11-8 4-7-4-14-4-17-6
Output for 7.1.25
7-21-11-24-5-11-23-20-6-3-16-2-18-2-17-20-22-8-8-16-6-7-24-0-20-17-20-19-0-8-0-22-0-2-0-19-23-1-23-14-16-4-2-0-25-17-9-5-10-16 6-9-6-9-5-3-3-5-12

preferences:
45.52 ms | 401 KiB | 40 Q