Odd strpos behavior

前端 未结 1 1560
梦谈多话
梦谈多话 2020-12-22 01:30

This is my code:



        
相关标签:
1条回答
  • 2020-12-22 01:43

    strpos() can return false if the string isn't found or 0 if the string is found at the very beginning. However 0 evaluates to false in a boolean check so you need to explicitly check the type:

    $soft404test = strpos($contloc, "http://www.uhasselt.be/404b.htm") !== false;
    
    0 讨论(0)
提交回复
热议问题