PHP String Position as Search
A simple way to check if one string is contained within another is using the php function strpos. What it actually does is return the integer string position where the needle inside the haystack, or boolean false if the string is not found. Some people use a conditional where they check if the string position is greater than 0 to mean that the one string is contained somewhere inside the other. This almost works, except for the case where the needle is at the beginning of the haystack where strpos will find it at position 0.
You’re currently reading “ PHP String Position as Search ,” an entry on BRADINO
- Published:
- 3.26.07 / 4pm
- Category:
- PHP












