dpu66046 2011-04-20 17:09 采纳率: 0%
浏览 49
已采纳

为什么这些字符串不匹配!?! - PHP

I have an if statement with several conditions:

if (
    (fncIsSet($row[0]['incident']) == $line[4]
     && fncIsSet($row[0]['id']) == $line[0]
     && fncIsSet($row[0]["code"]) == $line[2]
    )
    && (
        ($GLOBALS['postCheckList'] == 2
         && $row[0]['QAResult']=='Fail'
        )
        || ($GLOBALS['postCheckList'] != 2)
    )
){

I have a large list of items going through this piece of logic (5000+ values) and about 99.9% pass through as expected.

I've stepped through the debugger a dozen times so I can confirm that the first 2 conditions are passing but the third is failing:

fncIsSet($row[0]["code"]) == $line[2]

Here are the vars that it's trying to compare (copied straight from the source) with their Hex codes beneath them:

Ambulance-2
Ambulance-2
41 6D 62 75 6C 61 6E 63 65 2D 32 
41 6D 62 75 6C 61 6E 63 65 2D 32 

WTF, right? I can't see any reason why these aren't working especially when other very similar variables are passing through fine (ie Ambulance-1 and Ambulance-3).

Here is another example:

Anzemet
Anzemet
41 6E 7A 65 6D 65 74 
41 6E 7A 65 6D 65 74 
  • 写回答

2条回答 默认 最新

  • doumen5895 2011-04-20 17:10
    关注

    I'll bet dollars to donuts you've got trailing whitespace issues. Try printing out your variables with delimiters on either end (pipes are always good), or using var_dump() to deeply inspect your variables.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥35 MIMO天线稀疏阵列排布问题
  • ¥60 用visual studio编写程序,利用间接平差求解水准网
  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?
  • ¥15 win10权限管理,限制普通用户使用删除功能
  • ¥15 minnio内存占用过大,内存没被回收(Windows环境)
  • ¥65 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?