Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html>
- <head>
- <title>10.Third Digit is 7</title>
- <meta charset="windows-1251"/>
- </head>
- <body>
- <h2>Третото число 7 ли е?</h2>
- <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="get">
- Въведете число: <input name="number" size="10">
- <input type="submit" name="send" value="ОК">
- </form>
- <?php
- if(isset ($_GET['send'])) {
- $number = $_GET['number'];
- $digit=($number/100)%10;
- //is_numeric($number) - проверява дали стойността е число било то цяло или с плаваща запетая
- if(is_numeric($number) && $digit==7){
- echo $number." True <br/>";
- }
- else if(is_numeric($number) && $digit!=7){
- echo $number." False <br/>";
- }
- else{
- echo "Въведената стойност не число. Въведете число!";
- }
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement