php *nix fortune


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.