I'm trying to determine whether or not two strings match, and even though when I print them out, they're identical, it still says they don't match. I tried to cast them both as strings, and I tried using '===' instead of '==', but neither solved the problem...
if(preg_match("#^Availability:#", $test)) {
//just to note: $test = "Availability: Lorem Ipsum";
$nid = 1;
$prep = explode("Availability:", $test);
$orig = node_load($nid);
print $prep[1]; //Prints Lorem Ipsum
print($orig->title); //Prints Lorem Ipsum
if((string)$orig->title == (string)$prep[1]) {
print 'ok';
} else {
print 'nope'; //Always prints nope
}
...
$test has a space after Availability
: maybe you must trim strings before comporation. like that
if(trim($orig->title) == trim($prep[1]))