Re: Regular Expressions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alberto García Gómez wrote:
I'm a mess in regular expressions and I make this code:

$link = ereg_replace('ñ','n',$link); $link = ereg_replace('á','a',$link); $link = ereg_replace('é','e',$link); $link = ereg_replace('í','i',$link); $link = ereg_replace('ó','o',$link); $link = ereg_replace('ú','u',$link);
I ask if is a way to make those lines into a single one but working as well as this piece. I'm thinking in increase those lines so will be wonderful if I can optimize the code.



Este correo ha sido enviado desde el Politécnico de Informática "Carlos Marx" de Matanzas.
"La gran batalla se librará en el campo de las ideas"


<?php

$replacements = array(
	'&ntilde;' => 'n',
	'&aacute;' => 'a',
	'&eacute;' => 'e',
	'&iacute;' => 'i',
	'&oacute;' => 'o',
	'&uacute;' => 'u',
	);

$out = str_replace(array_keys($replacements), array_values($replacements), $in);





--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux