I have a function which I'm not entirely sure how to convert to get it working with PHP 7.2:
static function toCamelCaseFromUnderscore($str) {
$func = create_function('$c', 'return strtoupper($c[1]);');
return preg_replace_callback('/_([a-z])/', $func, $str);
}