I create an array of text and links and randomly pick one to get displayed in a news bar on my website here I want this script to be optimized as well as having an extra 'feature' I want to be able to determine the amount of times it appears for Ex:: "good morning" to be displayed 10% of the time.
<?php
$news = array(); //News Feed Array
$news[] = '<a href="URL">Good morning!</a>';
$news[] = '<a href="URL">have a nice day</a>';
$news[] = 'work hard!';
$news[] = '<a href="URL">experience makes man perfect.</a>';
$news[] = '<a href="URL">hard work never fails</a>';
echo $news[array_rand($news)];
?>