<?php
$str = "asd,ad";
if(preg_match(",",$str)) {
echo "ok";
}
?
It outputs me
开发者_运维问答No ending delimiter ',' found in....
?>
your pattern can be replaced to strpos
instead
if(strpos($str, ",")!==false)
{
echo "ok";
}
You are missing delimitters, try this:
$str = "asd,ad";
if(preg_match("/,/",$str)) {
echo "ok";
}
To find out more instances, you may want to use preg_match_all
function too.
精彩评论