RE: [PHP] Replacing 2 strings
| From: | Murray @ PlanetThoughtful | Date: | Mon, 30 May 2005 15:13:05 +0000 |
| Subject: | RE: [PHP] Replacing 2 strings | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-215994@lists.php.net to get a copy of this message | ||
> 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