On 30/05/05, Brian V Bonini <b-bonini@xxxxxxx> wrote: > 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.... This is a great help, thanks to both. One question I have though. How do I just leave the formatting "as is"? In the loop you gave me, Brian...: foreach($pieces as $char) { $first_letter[] = $char{0}; $remainder[] = strtolower(substr($char, 1)); } $result = array_merge($first_letter, $remainder); list($frstltr,$lstltr,$frstwrd,$lstwrd) = $result; $string = $frstltr . $frstwrd . " v " . $lstltr . $lstwrd; return $string; } I can't see how I can disregard strtolower without disrupting the rest of the function! My problem is $string contains a whole load of text, the formatting of which needs to be retained... -- Will The Corridor of Uncertainty http://www.cricket.mailliw.com/ - Sanity is a madness put to good use - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php