Thanks a lot brother.
I tested it with a few variations. It works perfectly. Its really great and simple usage of the existing functions. It would be glad to all PHP folks and good to PHP if these kind of functions will be in PHP library on upcoming releases.
<?php
$name1 = "mark-yves robert";
$name2 = "mark-yves robert-bryan";
echo '<br/>Name 1 (mark-yves robert) =>'.
ucwordspecific($name1,'-'); echo '<br/>Name 2 (mark-yves robert-bryan)
=>'.ucwordspecific($name2,'-');
function ucwordspecific($str,$delimiter){
$delimiter_space = '- ';
return str_replace($delimiter_space,$delimiter,ucwords
(str_replace($delimiter,$delimiter_space,$str)));
}
?>
Proud to be a PHP enthusiast always :-)