"Fortune" to php

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
User avatar
redhair
Forum Contributor
Posts: 300
Joined: Fri May 30, 2003 4:36 pm
Location: 53.23N-6.57E
Contact:

"Fortune" to php

Post by redhair »

Code: Select all

<?php

exec ("/usr/games/fortune", $fortuneArray); 
reset($fortuneArray);
while (list ($key, $val) = each ($fortuneArray))
    {
       $fortune .= "<br>\n" . trim($val);
    }
echo $fortune;

?>
:D

I was so happy to get this to work....I had to share it.
Post Reply