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
if($str === false)
is better - asstrpos
returns an index if it is not false.if($str === false) echo 'No'; else echo 'OK';
– Ruvolostrpos
will never return an explicit booleantrue
value. – Engineering