public static function replaceFirstOccurrence($search, $replace, $subject)
    {
        if (!$search) {
            return $subject;
        }

        $pos = mb_strpos($subject, $search);
        if ($pos !== false) {
            $subject = static::mb_substr_replace($subject, $replace, $pos, mb_strlen($search));
        }


        return $subject;
    }
public static function replaceFirstOccurrence($search, $replace, $subject)
    {
        if (!$search) {
            return $subject;
        }

        $pos = mb_strpos($subject, $search);
        if ($pos !== false) {
            $subject = static::mb_substr_replace($subject, $replace, $pos, mb_strlen($search));
        }


        return $subject;
    }
public static function replaceFirstOccurrence ( $ search , $ replace , $ subject ) { if ( ! $ search ) { return $ subject ; } $ pos = mb_strpos ( $ subject , $ search ) ; if ( $ pos !== false ) { $ subject = static :: mb_substr_replace ( $ subject , $ replace , $ pos , mb_strlen ( $ search ) ) ; } return $ subject ; }
Utility method to replace only the first occurrence in a string

@param string $search
@param string $replace
@param string $subject

@return string
Utility method to replace only the first occurrence in a string