- strtr: documentation ( source)
- ucwords: documentation ( source)
- str_replace: documentation ( source)
- lcfirst: documentation ( source)
<?php
function toCamelCase($word) {
return lcfirst(str_replace(" ", "", ucwords(strtr($word, "_", ""))));
}
echo toCamelCase("event_camel_case") . PHP_EOL;
echo toCamelCase("event") . PHP_EOL;