请教下PHP这里的代码那里出错了
10行 $Student=array("James Patt","John Smith","Susan Carter","Joe Smith","Janet Jones");
11行 $array_smith=preg_grep("/^Smith",$Student);
下面是出错提示
Warning: preg_grep() [function.preg-grep]: No ending delimiter '/' found in c:\Inetpub\wwwroot\zhanger\text.php on line 11
照理说应该是前面的/^有错误,查找出所以 Smith名字的人!是不是通用符使用错误了?那php的通用符是什么,要怎么改呢,谢谢指点下
问题点数:6、回复次数:1Top
1 楼aniude(重返荣耀)回复于 2006-03-03 17:11:55 得分 0
$array_smith=preg_grep("/^Smith",$Student);
=====>
$array_smith=preg_grep("/^Smith$/",$Student);
Top




