public static function multiReplace($map, $subject, $repeat = false)
    {
        do {
            $count = $c = 0;
            foreach ($map as $search => $replace) {
                $subject = str_replace($search, $replace, $subject, $c);
                $count += $c;
            }
        } while ($repeat && $count > 0);
        return $subject;
    }