Jump to content

Help with an "if" statement.


JoshuaDempsey

Recommended Posts

I am trying to get user input from the command line, but everytime I run this no matter what I enter I get "hi" returned. I don't know why this isn't working, and was hoping someone could take a quick look at it. Thank you:

 

function getUserInput(){
fwrite(STDOUT, "Enter your choice\n"); 
$selected = fgets(STDIN);                
if ($selected = "josh"){
echo "hi";
}
else{
break;
}
}

Link to comment
https://forums.phpfreaks.com/topic/274739-help-with-an-if-statement/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.