What I'm trying to do is to have PHP read a txt file, and put it into an array, with each line of the txt file being an individual element (each line of the txt file hold a url). After doing this, I would like for the array to be randomly organised, so that when a html button is pushed, a randomly selected url from the array is outputted into a new tab. This is the code I have so far:
            <?php
            $urls = file_get_contents('txtfilehere'), FILE_IGNORE_NEW_LINES);
            $random = $urls[mt_random(0, count($urls) - 1)];    
            ?>
         <script type="text/javascript">
            function randsite($urls){
                window.location = $urls;
            }
            </script>
            <h5> →  <button id="randsite"> PLEASE! </button> ← </h5>
        
Any help would be greatly appreciated.
