src/Helper.php
public static function preg_replace_array($pattern, array $replacements, $subject)
    {
        return preg_replace_callback($pattern, function () use (&$replacements) {
            foreach ($replacements as $key => $value) {
                return array_shift($replacements);
            }
        }, $subject);
    }
public static function preg_replace_array($pattern, array $replacements, $subject)
    {
        return preg_replace_callback($pattern, function () use (&$replacements) {
            foreach ($replacements as $key => $value) {
                return array_shift($replacements);
            }
        }, $subject);
    }
public static function preg_replace_array ( $ pattern , array $ replacements , $ subject ) { return preg_replace_callback ( $ pattern , function ( ) use ( & $ replacements ) { foreach ( $ replacements as $ key => $ value ) { return array_shift ( $ replacements ) ; } } , $ subject ) ; }
Replace a given pattern with each value in the array in sequentially.

@param  string  $pattern
@param  array   $replacements
@param  string  $subject
@return string
Replace a given pattern with each value in the array in sequentially .