由于弃用而更新到 eregi()


Update to eregi() resulting from deprecation

我必须更新一行由于从 PHP 5.2.x 到 5.3.x 而被弃用的代码

代码行为:

if (eregi('Itemid=[0-9]+', $string) === false) {

有谁知道新的 preg_match() 参数也应该转换什么?

谢谢

if( !preg_match( '/Itemid=[0-9]+/i', $string ) ) {
}
if ( !preg_match('/Itemid=[0-9]+/i', $string)) {

但也许真正需要的是

if ( !preg_match('/^Itemid=[0-9]+$/i', trim($string))) {