Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1. <?php
  2. if (isset($_POST['submit'])) {
  3.   $wordChunks = explode(" ", $_POST['somewords']);
  4.   for($i = 0; $i < count($wordChunks); $i++){
  5.     echo "Piece $i = $wordChunks[$i] <br />";
  6.   }
  7.  
  8.   $wordChunksLimited = explode(" ", $_POST['somewords'], 4);
  9.   for($i = 0; $i < count($wordChunksLimited); $i++){
  10.     echo "Limited Piece $i = $wordChunksLimited[$i] <br />";
  11.   }
  12. }
  13. else {
  14. ?>
  15. <form action="#" method="post">
  16.   <input type="textfield" name="somewords" />
  17.   <input type="submit" name="submit" value="Submit" />
  18. </form>
  19. <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement