[wd_asp elements=’search’ ratio=’100%’ id=1]

Strpos – Find string in PHP variable – Contains

30th August 2013

Php - Strings

php codehaven

Find a needle in a haystack! If you need to see if a PHP string contains a word, this code snippet would work.


if (!strpos($url,'dog')) {
echo 'No dog.';
} else {
echo 'Found dog.';
}