src/Koldy/Util.php
public static function a(string $text, string $target = null): string
    {
        return preg_replace('@((https?://)?([-\w]+\.[-\w\.]+)+\w(:\d+)?(/([-\w/_\.]*(\?\S+)?)?)*)@',
          "<a href=\"\$1\"" . ($target != null ? " target=\"{$target}\"" : '') . ">$1</a>", $text);
    }
public static function a(string $text, string $target = null): string
    {
        return preg_replace('@((https?://)?([-\w]+\.[-\w\.]+)+\w(:\d+)?(/([-\w/_\.]*(\?\S+)?)?)*)@',
          "<a href=\"\$1\"" . ($target != null ? " target=\"{$target}\"" : '') . ">$1</a>", $text);
    }
public static function a ( string $ text , string $ target = null ) : string { return preg_replace ( '@((https?://)?([-\w]+\.[-\w\.]+)+\w(:\d+)?(/([-\w/_\.]*(\?\S+)?)?)*)@' , "<a href=\"\$1\"" . ( $ target != null ? " target=\"{$target}\"" : '' ) . ">$1</a>" , $ text ) ; }
Detect URLs in text and replace them with HTML A tag

@param string $text
@param string $target optional, default _blank

@return string
Detect URLs in text and replace them with HTML A tag