Question : Function returns both true and false

This is probably a VERY easy fix, but for some reason my brain isn't letting me see what is wrong here so I need another pair of eyes.  I have a function, that when it is being returned, it is returning a 1 (TRUE), but it when I setup a bunch of If/else statements, apparently $sms also == "foo" (or anything else I can think of to put in there).  So, my question is why $sms=="foo" is a true statement when $sms is only supposed to be == to TRUE (assuming we had success in the script)?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
$sms=send_sms($_POST['number'], $_POST['message']);
       if ($sms==FALSE) {
           print "Please enter a valid phone number.<br />";
       }
        
       if ($sms=="foo"){ 
           print "We are sorry, but our SMS system has been used up today.  Try again tomorrow.";
       }
       
       if ($sms==TRUE) {
           print "We have attempted to send your text message<br />";
       }

Answer : Function returns both true and false

> if ($sms=="foo"){

if $sms is true, that will indeed also return true. ..

try this instead (and make sure you don't have any other test with "if ($sms=something) aka missing a "=":
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
$sms=send_sms($_POST['number'], $_POST['message']);
       if ($sms===FALSE) {
           print "Please enter a valid phone number.<br />";
       }
        
       if ($sms==="foo"){ 
           print "We are sorry, but our SMS system has been used up today.  Try again tomorrow.";
       }
       
       if ($sms===TRUE) {
           print "We have attempted to send your text message<br />";
       }
Random Solutions  
 
programming4us programming4us