- array_map: documentation ( source)
- implode: documentation ( source)
- explode: documentation ( source)
- ucfirst: documentation ( source)
<?php
function v1($value) {
return implode(array_map(function($value) { return ucfirst($value); }, explode('_', $value)));
}
#function v2($value) {
# return preg_replace_callback('/([A-Z])/', function($char) { return '_'.strtolower($char[1]); }, lcfirst($value));
#}
for($x = 0; $x < 10000; $x++){
$foo = v1('foo_bar_baz_bee');
}