/** * Removes prefixes defined in array from string. * * Example: * <code> * $string = 'prefixRest'; * $withoutPrefix = Strings::removePrefixes($string, array('pre', 'fix')); * </code> * Result: * <code> * Rest * </code> * * @param string $string * @param array $prefixes * @return mixed */ public static function removePrefixes($string, array $prefixes) { return array_reduce($prefixes, function ($string, $prefix) { return Strings::removePrefix($string, $prefix); }, $string); }
public static function removePrefix($prefix) { return function ($string) use($prefix) { return Strings::removePrefix($string, $prefix); }; }