3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Create an array and push on the names // of your closest family and friends $everyone = array("Tsuji", "Cover", "WildWind", "Grim", "Cupcake", "SoulWind", "Madara"); $contestants = array(); $numcontestants = rand(3,5); for ($i = 1; $i <= $numcontestants; $i++) { $indextoadd = rand(0,count($everyone)-1); array_push($contestants,$everyone[$indextoadd]); array_splice($everyone,$indextoadd,1); $search = true; } // Sort the list sort($contestants); ?> <h3>Contestants</h3> <ul> <?php foreach ($contestants as $person) { echo "<li>{$person}"; } ?> </ul> <?php // Randomly select a winner! $winner = $contestants[rand(0,count($contestants)-1)]; // Print the winner's name in ALL CAPS echo "<p>The winner is " . strtoupper($winner) . "!</p>"; ?>

preferences:
35.26 ms | 402 KiB | 5 Q