run code in 200+ php & hhvm versions
Bugs & Features
<?php echo preg_replace_callback('/([a-z])(_[a-z])/', function($u) { //var_dump($u); return $u[1].ucwords(str_replace('_', '', $u[2])); } , 'rob_tr_yuui'); echo PHP_EOL; echo preg_replace('/([a-z])(_[a-z])/', '$1$2', 'rob_tr_yuui'); function to_camel_case($str, $capitalise_first_char = false) { if($capitalise_first_char) { $str[0] = strtoupper($str[0]); } $func = create_function('$c', 'return strtoupper($c[1]);'); return preg_replace_callback('/_([a-z])/', $func, $str); } echo PHP_EOL; echo to_camel_case('rob_tr_yuui')

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)