/** * Makes a plural word singular. * * @param string word to singularize * @param integer number of things * @return string */ public static function singular($str, $count = NULL) { $parts = explode('_', $str); $last = inflector::_singular(array_pop($parts), $count); $pre = implode('_', $parts); if (strlen($pre)) { $pre .= '_'; } return $pre . $last; }