Advertisement
Guest User

spaces count

a guest
Feb 14th, 2020
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.45 KB | None | 0 0
  1. <html>
  2. <body>
  3. <form action="" method="POST">
  4. <input type="text" name="text" />
  5. <input type="submit" value="احسب عدد المسافات" />
  6. <br /> <br />
  7. </body>
  8. </html>
  9. <?php
  10. if (isset($_POST["text"]))
  11. {
  12.     $text = $_POST["text"];
  13.     $count = substr_count($text , " ");
  14.     if ($count != 0)
  15.     {
  16.         echo "عدد المسافات في النص = ". $count;
  17.     }
  18.     else {
  19.         echo "لاتوجد أي مسافة";
  20.     }
  21. }
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement