-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,616
  • 31
  • 92
  • 158

2 Answers2

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

}
Esailija
  • 134,577
  • 23
  • 263
  • 318
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
  • 11,480
  • 2
  • 37
  • 60