Skip to content

Instantly share code, notes, and snippets.

@WGrape
Created February 17, 2022 05:16
下划线转驼峰
<?php
function snakeToCamelCase($string){
$result = '';
$subIndexArr = explode('_', $string);
foreach ($subIndexArr as $index => $temp) {
if ($index === 0) {
$result .= $temp;
} else {
$result .= ucfirst($temp);
}
}
return $result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment