public static function delimiterToCamelCase($string, $delimiter = '[\\-\\_]')
{
// php doesn't garbage collect functions created by create_function()
// so use a static variable to avoid adding a new function to memory
// every time this function is called.
static $callback = null;
if ($callback === null) {
$callback = create_function('$matches', 'return strtoupper($matches[1]);');
}
return preg_replace_callback('/' . $delimiter . '(\\w)/', $callback, $string);
}