I have the block of php code below to help me filter results. It doesn’t work even though $match is true. Any ideas what the problem is?
<?php
// My matche Scenario //
if($theyWant == "Men who like women" && $meWant == "Women who like men") {
$match == true;
}
if($match == true) {
print "You have a match";
}
?>
Is $match initialized somewhere before that block?
if not and the the condition for the first IF statement is not met, $match will be undefined when it reaches the second one causing a warning.
Just wondering is the first IF_statement there ONLY to set $match?
if that’s the case I would recommend doing this:
$match = ($theyWant == "Men who like women" && $meWant == "Women who like men");
if($match == true) {
print "You have a match";
}
thats the most modular solution, tho if you are CERTAIN that you are only using $match that one time in your script, you can simplify the code and get rid of the variable entirely:
if ($theyWant == "Men who like women" && $meWant == "Women who like men") {
print "You have a match";
}