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