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