$string = "MaryGoesToSchool";
$expectedoutput = "Mary Goes To School";
Try:
$string = 'MaryGoesToSchool';
$nStr = preg_replace_callback('/[A-Z]/', function($matches){
return $matches[0] = ' ' . ucfirst($matches[0]);
}, $string);
echo trim($nStr);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With