From what you've been posting, it looks like you are trying to convert some logical expressions thru PHP.
I am illogical, so I don't have the faintest on this last one. Other than what you are describing sounds like a job for the eval function.
This evaluates to false:
<?
$str = "1 && 0";
eval("\$str = " . $str . ";");
if ($str) {
echo "x";
} else {
echo "y";
}
?>