Hello again everyone, I found this great regex which is very effective in adding a space before every capital letter. You can think a lot of things where to use this function.
So without further blah blah, see the function below
<?php function SpaceBeforeCapital($string){ return preg_replace('/(?<!\ )[A-Z]/', ' $0', $string); } $SampleString = 'ReginValerianoWebDeveloper'; echo SpaceBeforeCapital($SampleString); ?>
Result string below:
Regin Valeriano Web Developer
NOTE: Im not the original writer of the regex I just found it on the web, I think its interesting, gave it a try and it works
now made as a function.