3v4l.org

run code in 300+ PHP versions simultaneously
<?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 git.master, git.master_jit, rfc.property-hooks
robTrYuui rob_tr_yuui Fatal error: Uncaught Error: Call to undefined function create_function() in /in/QduQl:37 Stack trace: #0 /in/QduQl(49): to_camel_case('rob_tr_yuui') #1 {main} thrown in /in/QduQl on line 37
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
32.44 ms | 401 KiB | 8 Q