Hmm... what have you tried? This works for me:
<?php
$strings = array(
'camelCase',
'camelcase',
'sOme worDswhichDon\'tGoTogether'
);
$pattern = '/(.*?[a-z]{1})([A-Z]{1}.*?)/';
$replace = '${1} ${2}';
foreach($strings AS $string)
{
echo '<strong>Original:</strong> ', $string,
'<br /><strong>Replaced:</strong>',
preg_replace($pattern, $replace, $string),
'<br />';
}
?>
Gives this output:
Original: camelCase
Replaced:camel Case
Original: camelcase
Replaced:camelcase
Original: sOme worDswhichDon'tGoTogether
Replaced:s Ome wor Dswhich Don't Go Together
That's what you want isn't it?