3v4l.org

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')
Output for 5.4.0 - 5.4.23
Parse error: syntax error, unexpected end of file, expecting ',' or ';' in /in/7bi3F on line 49
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected $end, expecting ',' or ';' in /in/7bi3F on line 49
Process exited with code 255.