Opening link in new window (target="_blank") in PHP

Hello dear Forum,

I am quite new in here and this is my first post, but I have run into little problem with one of my project I am developing. For more clearly, I need to get PHP code ($new_link), which gets it’s link from database ($new_link = $business->linkto , where $business->linkto is the path for getting link from database).

Problem is that I want to make this $new_link or I have to make $link code to open in new window (target=“_blank”) perhaps :)?

Snippet of the code I am dealing with:

[COLOR=“DarkRed”]if (!empty($business->linkto)) {
$new_link = $business->linkto;
$link = $new_link;
//part where i need to get links open in new window

} else {
$link = JRoute::_( 'index.php?option=com_svmap&layout=business&business='.$business->id.'&name='.JFilterOutput::stringURLSafe($business->name) );

1.) <?php
function n3y_url_shorten($url,$chr_limit = 30,$add = ‘…’) {
return preg_replace(“!(http:/{2}[\w\.]{2,}[/\w\-\.\?\&\=\#]*)!e”, “'<a href=\”\\1\" title=\“\\1\” target=\“_blank\”>‘.(strlen(’\\1’)>=$chr_limit ? substr(‘\\1’,0,$chr_limit).‘$add’:‘\\1’).‘</a>’", $url);

2.) PHP Function to Auto Convert URL into Hyperlink | ZENVERSE

3.) [RESOLVED] preg_match and preg_replace -

4.) PHP Tutorials Examples URL to Link

Thank you very much in advance, if there is anybody who can help me out with this issue… :slight_smile:

If nobody can help me and I found answer for my issue before anybody else I will let you know immidiately :slight_smile:

Best regards,

I also add this PHP file, where the code Snippet was taken in post before :slight_smile:

Best regards,