When I use strpos(), it isn't able to locate "[" if that bracket is the first character in the string. How can I overcome this issue and why is this happening?
$name = "[johnny";
if(strpos($name, "[") != false){
echo "Bracket found!";}else{
echo "Not found";
}
In the above code, I get "Not found" when it shouldn't be the case.
$name = "jo[hnny";
if(strpos($name, "[") != false){
echo "Bracket found!";}else{
echo "Not found";
}
But this case correctly returns "Bracket found!"