HI,
I need to search for “*” in $value. The below code is not matching. Please help.
if(preg_match('/(*)/i',$value))
{
$fields.="";
echo "* is selected<br>";
}
Thanks,
Ramki
HI,
I need to search for “*” in $value. The below code is not matching. Please help.
if(preg_match('/(*)/i',$value))
{
$fields.="";
echo "* is selected<br>";
}
Thanks,
Ramki
Don’t use regular expressions to test if a simple string is contained in another string
if(false !== strpos($value, '*')) {
echo "* is selected<br>";
}
Also, there’s no point appending an empty string to $fields, it changes nothing.