if语句在输出相同值时返回false

时间:2017-04-28 12:23:42

标签: php

我正在尝试比较mysql返回的行和我的代码中提取的行,但是当strlen返回相同的行并且输出完全相同时,它会一直返回false。

if(trim($checkComplete['WorkOrder']) == trim($wo)) {
    //Do nothing
} else {
    //WorkOrder does not match
    echo "WorkOrder does not match!<br>".$wo." | ". $checkCompleteAssoc['WorkOrder']."<br>";
    echo strlen($wo)."<br>";
    echo strlen($checkCompleteAssoc['WorkOrder'])."<br>";

输出:

WorkOrder does not match!
39809337 | 39809337
8
8

1 个答案:

答案 0 :(得分:0)

我认为您使用了错误的变量$checkComplete

if(trim($checkCompleteAssoc['WorkOrder']) == trim($wo)) {
    //Do nothing
} else {
    //WorkOrder does not match
    echo "WorkOrder does not match!<br>".$wo." | ". $checkCompleteAssoc['WorkOrder']."<br>";
    echo strlen($wo)."<br>";
    echo strlen($checkCompleteAssoc['WorkOrder'])."<br>";