- var_dump: documentation ( source)
- preg_replace_callback: documentation ( source)
- strtoupper: documentation ( source)
<?php
function camelize($string)
{
return preg_replace_callback('/(_|\.|^)+(.)/', function ($match) { return ('.' === $match[1] ? '_' : '').strtoupper($match[2]); }, $string);
}
var_dump(camelize('_code'));