开发者

Problem with ereg deprecated

Can some please help me to rewrite these code:

if (eregi($asked,$accepted)) {
 $this->plot_type = $which_pt;
 return true;
} else {
 $this->DrawError('$which_pt not an acceptable plot type');
 return false;
}

开发者_运维技巧Any help will be highly appreciated, I have tried all the fix I got through Google but none has been able to fix it.

Thanks.


if ( preg_match($asked."i",$accepted) ) // there is no case insensitive version of preg_match
{
    $this->plot_type = $which_pt;
    return true;
} else {
    $this->DrawError("$which_pt not an acceptable plot type"); // i think you want " instead of ' here
    return false;
}

should do it. If it doesn't, please share with us the content of the regular expression in $asked.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜