$string = 'prefixRest'; $withoutPrefix = Strings::removePrefixes($string, array('pre', 'fix'));
Rest
public static function removePrefixes($string, array $prefixes) { return array_reduce($prefixes, function ($string, $prefix) { return Strings::removePrefix($string, $prefix); }, $string); }
/** * @test */ public function shouldRemovePrefixes() { //given $string = 'prefixRest'; //when $withoutPrefix = Strings::removePrefixes($string, array('pre', 'fix')); //then $this->assertEquals('Rest', $withoutPrefix); }