public underscore ( string $id ) : string | ||
$id | string | The string to underscore |
Résultat | string | The underscored string |
public function underscore($id)
{
return strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\\d])([A-Z])/'], ['\\1_\\2', '\\1_\\2'], $id));
}