我有不同的字符串,它们是函数名,例如
createWebsiteManagementUsers
我想把它们改成
Create Website Mangement Users
我如何在 PHP 中实现它?
最佳答案
a) 你可以使用 ucwords()
:-
echo ucwords($string);
b) 在您预期的结果空间中,如果您想要那样做:
echo ucwords(implode(' ',preg_split('/(?=[A-Z])/', 'createWebsiteManagementUsers')));
关于php - 如何在 PHP 中将驼峰式大小写转换为大写英文单词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42664975/