Baseball Freak
New member
Right now I have this little part on my PHP script:
fwrite(STDOUT, "\nWould you like to choose your favorite number? (Yes/No):\n");
$Answer = trim(fgets(STDIN));
if ($Answer == "Yes") {
fwrite(STDOUT, "\nWhat number do you like?(1-50000)\n");
$Number = trim(fgets(STDIN));
echo"\nAttempting to do this.\n\n";
if ($Number >= 0 && $Number <= 25000) {
$Loops = 1;
while ($Loops <= 1) {
///////////////////////
// Do My Stuff //
///////////////////////
echo $i++;
}
} elseif($Number >= 25001 && $Number <= 50000) {
$Loops = 2;
while ($Loops <= 1) {
///////////////////////
// Do My Stuff //
///////////////////////
echo $i++;
}
} else {
echo"\n\n\n\n\n\n\nAn Error Occurred while getting the number. Try again.\n\n\n\n\n\n\n\n\n";
while(true){}
}
}
The problem is that when I type the number in Command Prompt and press enter, it won't do the stuff inside the if or elseif.
EX. I run the script and enter the number 27000. All the script will do is echo the "Attempting to do this" stuff. Not what is inside the brackets.
fwrite(STDOUT, "\nWould you like to choose your favorite number? (Yes/No):\n");
$Answer = trim(fgets(STDIN));
if ($Answer == "Yes") {
fwrite(STDOUT, "\nWhat number do you like?(1-50000)\n");
$Number = trim(fgets(STDIN));
echo"\nAttempting to do this.\n\n";
if ($Number >= 0 && $Number <= 25000) {
$Loops = 1;
while ($Loops <= 1) {
///////////////////////
// Do My Stuff //
///////////////////////
echo $i++;
}
} elseif($Number >= 25001 && $Number <= 50000) {
$Loops = 2;
while ($Loops <= 1) {
///////////////////////
// Do My Stuff //
///////////////////////
echo $i++;
}
} else {
echo"\n\n\n\n\n\n\nAn Error Occurred while getting the number. Try again.\n\n\n\n\n\n\n\n\n";
while(true){}
}
}
The problem is that when I type the number in Command Prompt and press enter, it won't do the stuff inside the if or elseif.
EX. I run the script and enter the number 27000. All the script will do is echo the "Attempting to do this" stuff. Not what is inside the brackets.