Php code to open link in new tab

You can use the target attribute in the a tag to open the link in a new tab. Here is an example:

<a rel="nofollow" target="_blank" href="https://www.example.com" target="_blank">Open in new tab</a>

This will open the link in a new tab when the link is clicked.

Alternatively, you can use PHP to generate the link and set the target attribute dynamically. Here is an example:

<?php
  $link = 'https://www.example.com';
  echo '<a rel="nofollow" target="_blank" href="'. $link. '" target="_blank">Open in new tab</a>';
?>

This will output the same HTML as the first example, but the link URL is generated dynamically using PHP.

You can also use JavaScript to open the link in a new tab. Here is an example:

<a rel="nofollow" target="_blank" href="https://www.example.com" onclick="window.open(this.href, '_blank'); return false;">Open in new tab</a>

This will open the link in a new tab when the link is clicked, and prevent the default link behavior (i.e. following the link in the current tab).

Note that the target attribute is not supported in all browsers, so it's a good idea to use a combination of target and JavaScript to ensure that the link opens in a new tab in all browsers.