ICanBoogie/Inflector

Is there a way to convert space seperated words to camelcase?

Closed this issue · 3 comments

Petah commented
Is there a way to convert space seperated words to camelcase?

To convert space separated words to camelcase you first need to replace white spaces by hyphens (or underscrores), as follows:

echo $inflector->camelize(preg_replace('/\s+/', '-', "A phrase to camel case"));
// APhraseToCamelCase
Petah commented

Thanks, that what I ended up using, would be nice to have helper method though ;)

That's an idea :)