Equal string comparisons are failing

后端 未结 2 1394
孤独总比滥情好
孤独总比滥情好 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: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.

提交回复
热议问题