3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $nums = []; for ($i = 1; $i <= 24; $i++) { $nums[] = $i; } print_r($nums); $days = []; for ($i = 1; $i <= 24; $i++) { $day = array_rand($nums); $days[] = $day; unset($day); } print_r($nums); print_r($days);
Output for 7.1.23
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 [7] => 8 [8] => 9 [9] => 10 [10] => 11 [11] => 12 [12] => 13 [13] => 14 [14] => 15 [15] => 16 [16] => 17 [17] => 18 [18] => 19 [19] => 20 [20] => 21 [21] => 22 [22] => 23 [23] => 24 ) Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 [7] => 8 [8] => 9 [9] => 10 [10] => 11 [11] => 12 [12] => 13 [13] => 14 [14] => 15 [15] => 16 [16] => 17 [17] => 18 [18] => 19 [19] => 20 [20] => 21 [21] => 22 [22] => 23 [23] => 24 ) Array ( [0] => 14 [1] => 2 [2] => 1 [3] => 16 [4] => 9 [5] => 0 [6] => 8 [7] => 12 [8] => 19 [9] => 6 [10] => 16 [11] => 19 [12] => 20 [13] => 10 [14] => 19 [15] => 11 [16] => 20 [17] => 9 [18] => 8 [19] => 1 [20] => 11 [21] => 9 [22] => 2 [23] => 19 )