- preg_replace_callback: documentation ( source)
- strtoupper: documentation ( source)
- strtolower: documentation ( source)
<?php
function to_camel_case($str) {
$str = strtolower($str);
return preg_replace_callback('/_([a-z])/', function(array $match) { return strtoupper($match[1]); }, $str);
}
echo to_camel_case($key = 'me_ApetEce_COMER_algo_jajjajaj');