Reply to RE: [PHP] Replacing 2 strings

Your name:

Reply:


Posted by Brian V Bonini on 11/26/58 11:17

On Mon, 2005-05-30 at 11:13, Murray @ PlanetThoughtful wrote:
> > Someone much more clever that I can probably come up with something much
> > cleaner and efficient but.... This works...
>
> Definitely not more clever and arguably not more efficient, but a different
> way of handling this might be:
>
> <?
>
> function replace($string){
> $string = preg_replace("/(<|\^|>)/", "",$string);
> $string = str_replace("_", " ", $string);
> $string = ucwords(strtolower($string));
> $string = str_replace(" ", "-", $string);
> return $string;
> }
>
> echo replace("<^JIM_JONES>");
>
> ?>

AHHH! ucwords(); I probably looked right at it a million times.. I knew
there had to be something to do that....


--

s/:-[(/]/:-)/g


Brian GnuPG -> KeyID: 0x04A4F0DC | Key Server: pgp.mit.edu
======================================================================
gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC
Key Info: http://gfx-design.com/keys
Linux Registered User #339825 at http://counter.li.org

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация