开发者

Problem with ereg deprecated

开发者 https://www.devze.com 2023-01-07 06:26 出处:网络
Can some please help me to rewrite these code: if (eregi($asked,$accepted)) { $this->plot_type = $which_pt;

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

精彩评论

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