Advertisement
Kokosaap

Untitled

Jan 12th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. <?php
  2. function clearCMD($clear)
  3. {
  4. if(PHP_OS =="Linux")
  5. {
  6. $clear = exec("clear");
  7. print($clear);
  8. }
  9. else
  10. {
  11. $clear = exec("cls");
  12. print($clear);
  13. }
  14. }
  15. clearCMD();
  16.  
  17. function typeWords()
  18. {
  19.  
  20. $catchWords = print "Bonjour ! Bienvenue sur le 'PHP Hangman' !\nVeuillez saisir votre mot :\n";
  21.  
  22. $fp = fopen('php://stdin', 'r');
  23. $last_line = false;
  24. $message = '';
  25.  
  26. while (!$last_line)
  27. {
  28. $next_line = fgets($fp, 1024); // read the special file to get the user input from keyboard
  29.  
  30. if (".\n" == $next_line)
  31. {
  32. $last_line = true;
  33. }
  34. else
  35. {
  36. $message .= $next_line;
  37. }
  38. }
  39.  
  40. }
  41. typeWords();
  42. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement