A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
27
Task/Integer-comparison/PHP/integer-comparison.php
Normal file
27
Task/Integer-comparison/PHP/integer-comparison.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
echo "Enter an integer [int1]: ";
|
||||
fscanf(STDIN, "%d\n", $int1);
|
||||
if(!is_numeric($int1)) {
|
||||
echo "Invalid input; terminating.\n";
|
||||
exit(1); // return w/ general error
|
||||
}
|
||||
|
||||
echo "Enter an integer [int2]: ";
|
||||
fscanf(STDIN, "%d\n", $int2);
|
||||
if(!is_numeric($int2)) {
|
||||
echo "Invalid input; terminating.\n";
|
||||
exit(1); // return w/ general error
|
||||
}
|
||||
|
||||
// now $int1 and $int2 are numbers.
|
||||
// for simplicity, this does not explicitly examine types
|
||||
|
||||
if($int1 < $int2)
|
||||
echo "int1 < int2\n";
|
||||
if($int1 == $int2)
|
||||
echo "int1 = int2\n";
|
||||
if($int1 > $int2)
|
||||
echo "int1 > int2\n";
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue