小弟測試了一下,如何抓取字串中的文字功能,發現當用到陣列時,好像就無法判斷
請問該如何解決
<?php
header("Content-Type:text/html; charset=UTF-8");
echo mb_strpos("老王喜歡哈哈笑abc,你說老蕭好笑不好笑1234","好",0,"UTF-8")+1;
echo '<hr>';
$A="老王喜歡哈哈笑abc,你說老蕭好笑不好笑1234";
$B="老";
echo mb_strpos($A,$B,0,"UTF-8")+1;
echo '<hr>';
$C=array("老王","喜歡","哈哈笑","你說","老蕭","好笑不好笑");
$D="老";
foreach ($C as $key=>$Value){
if(mb_strpos($C[$key],$D,0,"UTF-8")>0)
{echo "YES";
echo '<hr>';}
else
{echo "NG";
echo '<hr>';}
}
?>