Guest User

Untitled

a guest
Nov 7th, 2018
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. <?php
  2. /* Second variant */
  3.  while(true) {
  4.  $input = readline();
  5.  if($input == "END") return ;
  6.   if(is_numeric($input)) {
  7.       $sum = 0;
  8.       $sum += $input;
  9.        switch(gettype($sum)) {
  10.            case "integer": $type = "integer"; break;
  11.            case "double": $type = "floating point"; break;
  12.        }
  13.        echo "$input is $type type" . PHP_EOL;
  14.   }
  15.   if(strlen($input) == 1 && !is_numeric($input)) {
  16.       echo "$input is character type" . PHP_EOL;
  17.   } else if(strlen($input) > 1 && !is_numeric($input) && strtolower($input) != "true" && strtolower($input) != "false") {
  18.       echo "$input is string type" . PHP_EOL;
  19.   }  if(strtolower($input) == "true" || strtolower($input) == "false") {
  20.       echo "$input is boolean type" . PHP_EOL;
  21.   }
  22.  }
  23. ?>
Add Comment
Please, Sign In to add comment