Takes an under_scored version of a word and turns it into an human- readable form
by replacing underscores with a space, and by upper casing the initial character.
Parameters
- string $word Under_scored version of a word (i.e. `'red_bike'`).
- string $separator The separator character used in the initial string.
Returns
string Human readable version of the word (i.e. `'Red Bike'`).Source
public static function humanize($word, $separator = '_') {
if (isset(static::$_humanized[$key = $word . ':' . $separator])) {
return static::$_humanized[$key];
}
return static::$_humanized[$key] = ucwords(str_replace($separator, " ", $word));
}