$string = 'border-bottom-color'; $preg = '/-([a-z])/'; $newString = preg_replace_callback($preg, function($matches){ return ucwords($matches[1]); }, $string); echo $newString;
$string = 'border-bottom-color'; $preg = '/-([a-z])/'; $newString = preg_replace_callback($preg, function($matches){ return ucwords($matches[1]); }, $string); echo $newString;