use yii\helpers\Inflector; $camelString = 'firstName'; $wordsString = Inflector::camel2words($camelString); // output: 'first name' echo $wordsString;
echo Inflector::camel2words('thisIsAPHPfunction'); // output: 'this is a p h p function'In this example, we call the camel2words function with the string "thisIsAPHPfunction". The resulting output is "this is a p h p function", where each capital letter is separated by a space. Overall, the Inflector helper class is a useful utility for converting between different forms of words in Yii Framework. It's part of the yii\helpers package library.