Re: Regular Expressions

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

 



On Tue, 2007-11-06 at 20:15 -0800, Jim Lucas wrote:
> Robert Cummings wrote:
> > On Tue, 2007-11-06 at 23:24 -0300, Martin Alterisio wrote:
> >> 2007/11/6, Alberto García Gómez <alberto@xxxxxxxxxxxxxxxxx>:
> >>> I'm a mess in regular expressions and I make this code:
> >>>
> >>> $link = ereg_replace('&ntilde;','n',$link);
> >>> $link = ereg_replace('&aacute;','a',$link);
> >>> $link = ereg_replace('&eacute;','e',$link);
> >>> $link = ereg_replace('&iacute;','i',$link);
> >>> $link = ereg_replace('&oacute;','o',$link);
> >>> $link = ereg_replace('&uacute;','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.
> > 
> > <?php
> > 
> >     $map = array
> >     (
> >         '&ntilde;', 'n',
> >         '&aacute;', 'a',
> >         '&eacute;', 'e',
> >         '&iacute;', 'i',
> >         '&oacute;', 'o',
> >         '&uacute;', 'u',
> 
> one mistake, your commas above, between the index and value,
> should be a "=>" instead

Yeah, I didn't actually test after cutting/pasting and reformatting...
was feeling lazy... that'll learn me :)

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

-- 
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