Guest User

Untitled

a guest
Jan 11th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Extract Capital-Case Words</title>
  6. </head>
  7. <body>
  8. <?php
  9. if(isset($_GET['text'])) {
  10. $text = $_GET['text'];
  11. preg_match_all('/\w+/', $text, $words);
  12. $words = $words[0];
  13. $upperWords = array_filter($words, function ($word){
  14. return strtoupper($word) == $word;
  15. });
  16. echo implode(', ', $upperWords);
  17. }
  18. ?>
  19.  
  20. <form>
  21. <textarea rows="10" name="text"></textarea><br>
  22. <input type="submit" value="Find upper">
  23. </form>
  24. </body>
  25. </html>
Add Comment
Please, Sign In to add comment