public static function strReplaceOnce($pattern, $replacment, $subject)
    {
        $index = strpos($subject, $pattern);
        if ($index !== false) {
            return substr_replace($subject, $replacment, $index, strlen($pattern));
        }

        return $subject;
    }
public static function strReplaceOnce($pattern, $replacment, $subject)
    {
        $index = strpos($subject, $pattern);
        if ($index !== false) {
            return substr_replace($subject, $replacment, $index, strlen($pattern));
        }

        return $subject;
    }
public static function strReplaceOnce ( $ pattern , $ replacment , $ subject ) { $ index = strpos ( $ subject , $ pattern ) ; if ( $ index !== false ) { return substr_replace ( $ subject , $ replacment , $ index , strlen ( $ pattern ) ) ; } return $ subject ; }
Replaces found pattern in a subject only one time.

@param string $pattern
@param string $replacment
@param string $subject

@return string
Replaces found pattern in a subject only one time .