Foros del Web » Programando para Internet » PHP »

funcion eregi

Estas en el tema de funcion eregi en el foro de PHP en Foros del Web. La funcion eregi desaparece en PHP 6.0 y queria saber como la puedo remplazar, la utilizo asi Código PHP: if ( eregi ( '^('  .  $value  ...
  #1 (permalink)  
Antiguo 22/02/2010, 23:13
 
Fecha de Ingreso: abril-2007
Ubicación: Merlo
Mensajes: 314
Antigüedad: 17 años
Puntos: 3
funcion eregi

La funcion eregi desaparece en PHP 6.0 y queria saber como la puedo remplazar, la utilizo asi

Código PHP:
if (eregi('^(' $value ')(;q=[0-9]\\.[0-9])?$'$this->browser_languages[$i]) && isset($this->catalog_languages[$key])) {
            
$this->language $this->catalog_languages[$key];
            break 
2;

Como puedo remplazarla???

Desde ya muchas Gracias
  #2 (permalink)  
Antiguo 22/02/2010, 23:39
Avatar de camsworksinc  
Fecha de Ingreso: julio-2008
Ubicación: Queretaro
Mensajes: 261
Antigüedad: 15 años, 9 meses
Puntos: 11
Respuesta: funcion eregi

Encontre un comentario sobre esto:
Cita:
As for ereg to preg conversions, you only need to know a couple things.

In the preg functions, all your patterns have to be delimited. So for ereg_match("abc", $string) the conversion would be preg_match("/abc/", $string). If your pattern contains a forward slash, you may use any character not present in the pattern as a delimiter.

For eregi, you will need to make use of the pattern modifiers of perl-compatible expressions. eregi_match("abc", $string) becomes preg_match("/abc/i", $string)

preg is better, you'll like it more when you start using the modifiers and other advanced features.
La fuente:http://forums.devshed.com/php-develo...eg-503512.html
  #3 (permalink)  
Antiguo 23/02/2010, 08:50
Avatar de jackson666  
Fecha de Ingreso: noviembre-2009
Ubicación: Buenos Aires, Argentina
Mensajes: 1.971
Antigüedad: 14 años, 5 meses
Puntos: 65
Respuesta: funcion eregi

Si no me equivoco, la expresion te quedaria asi

Código PHP:
Ver original
  1. '/^(' . $value . ')(;q=[0-9]\\.[0-9])?$/'

Y la funcion que tenes que usar es preg_match()
__________________
HV Studio
Diseño y desarrollo web

Etiquetas: funcion
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 01:21.