RE: Replacing 2 strings

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

 



> 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>");

?>

Regards,

Murray

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