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