-1

I have to update a line of code that is deprecated as a result of going from PHP 5.2.x to 5.3.x

The code line is:

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

Does anyone know what the new preg_match() arguments should be converted too?

Thanks

H. Ferrence
  • 7,906
  • 31
  • 98
  • 161

2 Answers2

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

}
Esailija
  • 138,174
  • 23
  • 272
  • 326
0
if ( !preg_match('/Itemid=[0-9]+/i', $string)) {

but maybe what is really needed is

if ( !preg_match('/^Itemid=[0-9]+$/i', trim($string))) {
Walter Tross
  • 12,237
  • 2
  • 40
  • 64