<?php $urls = file("file.txt"); shuffle($urls); for($i=0;$i<count($urls);$i++) { echo $urls[$i]; } ?>