My solution to deal with single-character words:
$text = 'ThisIsATest';
echo preg_replace('/(?<!^)(?=[A-Z])/', ' ', $text);
PS:
"(?<!" = start of negative look-behind assertion, in this case checking that the capital letter is not at the start of the string
"(?=" = start of positive look-ahead assertion, in this case looking for any capital letter from A to Z
Therefore, it matches on the non-character position (or zero-length string?) between two characters, where the character on the right is a capital letter.