It just depends on the type of information that you're trying to compare and how you want to compare it.
PHP Code:
//Let's say we have this function
//NOTE: All functions do what they say they'll do, even if not defined.
function number_of_members_attending($meeting_id) {
if (meeting_exists($meeting_id)) {
//Now, calculate the number of members and store in $number_of_members
return $number_of_members;
} else {
//Meeting doesn't exist, so this question is inappropriate
return false;
}
}
Now, this function will return 3 possible values of interest:
1) false if the meeting_id is invalid or no meeting exists;
2) 0 if the meeting has no registered users;
3) > 0 if the meeting has some number of members.
Now, let's say that you were writing code which uses the function above:
PHP Code:
$members_attending = number_of_members_attending(20070315);
if ($members_attending) {
echo "There are ".$members_attending." members attending your meeting.";
} else {
echo "No meeting is scheduled.";
}
The code above would be inaccurate as a meeting may be scheduled and no members set to attend yet, so you could be more explicit by using:
PHP Code:
$members_attending = number_of_members_attending(20070315);
if ($members_attending === false) {
echo "No meeting is scheduled.";
} elseif ($members_attending == false) { //I'm just doing that as an example, normally I'd use $members_attending == 0
echo "No one is scheduled to attend this meeting yet.";
} else {
echo "There are ".$members_attending." members attending your meeting.";
}
By using identically equal ( === ) I am able to specifically distinguish between false and 0 which matters in this case (and, also, in the strpos case).
I hope that helps!