Split Word on Capital Letter

The following snippet converts firstName into first Name

echo preg_replace('/(?<!^)([A-Z])/', ' \\1', 'firstName');
Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn