Notice: A non well formed numeric value encountered in C:\xampp\htdocs\Space\Find\index.php on line 21

后端 未结 2 1875
梦谈多话
梦谈多话 2021-01-25 21:28


        
相关标签:
2条回答
  • 2021-01-25 22:17

    $offset is supposed to be numerical, but you are assigning a string to it in the while itself:

    echo $offset = $stringpos + $search_length.'<br/>';
    

    After this line, $offset is no longer a number and the second time the while is executed, you'd get that notice

    0 讨论(0)
  • 2021-01-25 22:21
    while($strpos=strpos($text,$search,(int)($offset))){
        echo $offset=($strpos+$search_length)."<br>";
    }
    

    Need a type casting in while loop... (int)($offset) That's it.

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