Equal string comparisons are failing

后端 未结 2 1349
孤独总比滥情好
孤独总比滥情好 2021-01-29 05:04

After hours of debugging, I have finally determine that for some reason on a particular web-server running my small script, two equal strings are apparently being interpreted as

相关标签:
2条回答
  • 2021-01-29 05:16

    Why don't you try using trim in your trim($data[0]); and compare it.

    0 讨论(0)
  • 2021-01-29 05:26

    Use trim() (note the second parameter, which accepts other chracters like ";" in your case) and strtolower() or strtoupper() on both strings just before comparision.

    Also, if you have the option to change the API response, try implementing a JSON response instead of returning a plain string. It will be less memory intensive and more maintainable.

    0 讨论(0)
提交回复
热议问题