how to check if '.'[dot] is present in string or not ? strstr is not working in php

php, strstr

Solution

You may use strpos directly.

if (strpos($mystring, ".") !== false) {
    //...
}

Hope this help :)

Problem

I am trying to see if . [dot] is present in string or not. I have tried strstr but it returns false. here is my code :- ``` <?php $str = strpos("true.story.bro", '.'); if($str === true) { echo "OK"; } else { echo "No"; } ?> ``` I want to see if '.' is present in string or not, I can do with explode, but i want to do in 1 line, how could i do that ? Thanks

Original source