make sure you follow the documentation for this function CAREFULLY, there's a tricky variable type pothole with it.
If the string you are searching for is not found in the bigger string, strpos returns FALSE, not -1 (as other languages like javascript do).
So, if you are using this function to determine whether or not a substring (or single character) exists, at any position, including position 0, and you just say:
Code:
if (strpos($biggerstr,"&") >= 0)
this will produce a TRUE even if the & is not found, because the FALSE that is returned from strpos will be typecast on-the-fly to an integer for comparison with 0, and FALSE will == 0, and the ">= 0" check will return true.
As the documentation says, to guard against this, you need to do stronger type checking in your test:
Code:
if (strpos($biggerstr,"&") !== false)
the operator === (three ='s) does an equality check that is type sensitive, meaning 0 does NOT === false, even though 0 == false. So, using !== will make sure that strpos does NOT return a false, but it can return any numbered position, including 0, and you'll be fine.
My other suggestion here is to consider just making the assumption for the user that this character (and possibly others that you want to make "illegal"

are just not allowed, so if they enter them, you just remove them. This is very easily done with str_replace:
Code:
$biggerstr = str_replace("&","",$biggerstr);
This will take ANY number of the & characters found and replace them with empty strings, in effect removing them entirely.
This will reduce the need to report back to the user an error. Just a thought.