我试图确定两个字符串是否匹配,即使我打印出来它们是相同的,它仍然说它们不匹配。我尝试将它们都转换为字符串,并尝试使用'==='而不是'==',但都没有解决问题......
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
}
...