$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
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.