- preg_replace_callback: documentation ( source)
- ucfirst: documentation ( source)
<?php
function _convertToCamelCase(array $matches)
{
return ucfirst($matches[1]);
}
$key = 'valami_underscored_cucc';
$keys = array(
'id'
);
foreach ($keys as $key) {
echo preg_replace_callback(
'/_(\w)/',
'_convertToCamelCase',
$key);
}