3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = array("Neo", "Morpheus", "Trinity", "Cypher", "Tank"); $randomize = array_slice($input,0,3); $keep_safe = array_slice($input,3); shuffle($randomize); print_r(array_merge($randomize,$keep_safe));
Output for 7.1.28 - 7.1.29, 7.3.1 - 7.3.2, 7.3.5, 7.4.0
Array ( [0] => Trinity [1] => Neo [2] => Morpheus [3] => Cypher [4] => Tank )
Output for 7.2.17, 7.3.9, 7.3.12
Array ( [0] => Neo [1] => Trinity [2] => Morpheus [3] => Cypher [4] => Tank )
Output for 7.1.27, 7.1.31, 7.2.21 - 7.2.22, 7.3.0, 7.3.11
Array ( [0] => Trinity [1] => Morpheus [2] => Neo [3] => Cypher [4] => Tank )
Output for 7.1.32 - 7.1.33, 7.2.24 - 7.2.25, 7.3.3, 7.3.7 - 7.3.8, 7.3.10
Array ( [0] => Morpheus [1] => Neo [2] => Trinity [3] => Cypher [4] => Tank )
Output for 7.1.30, 7.2.18 - 7.2.19, 7.3.4, 7.3.6
Array ( [0] => Morpheus [1] => Trinity [2] => Neo [3] => Cypher [4] => Tank )
Output for 7.1.26, 7.2.20, 7.2.23
Array ( [0] => Neo [1] => Morpheus [2] => Trinity [3] => Cypher [4] => Tank )

preferences:
51.3 ms | 402 KiB | 36 Q