Posted By

gdonald on 09/27/06


Tagged

nix fortune


Versions (?)

php *nix fortune


 / Published in: PHP
 

  1. function fortune()
  2. {
  3. $html = '';
  4.  
  5. exec( 'which fortune', $fortune );
  6.  
  7. if( $fortune )
  8. {
  9. exec( $fortune[ 0 ], $array );
  10. }
  11. else
  12. {
  13. return '';
  14. }
  15.  
  16. $x = count( $array );
  17.  
  18. for( $q = 0; $q < $x; $q++ )
  19. {
  20. $html .= $array[ $q ] . ' ';
  21. }
  22.  
  23. return $html;
  24. }

Report this snippet  

You need to login to post a comment.