- ucwords: documentation ( source)
- str_replace: documentation ( source)
- lcfirst: documentation ( source)
<?php
function underscoreToCamel ($str) {
// Remove underscores, capitalize words, squash, lowercase first.
return lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $str))));
}
echo underscoreToCamel('my_variable_name');