What's the fastest way to insert a string before the </a>
tag?
<a href="..."> bla bla... </a>
What's the fastest way to insert a string before the </a>
tag?
<a href="..."> bla bla... </a>
str_replace("</a>", "blabla</a>", $text);
There are many, many ways to skin this cat, but here are a few common ones:
IN HTML:
<a href=""><?php echo $foo; ?></a>
<a href=""><?=$foo?></a>
IN PHP
echo "<a href=\"\">$foo</a>";
echo "<a href=\"\">{$foo}</a>";
echo "<a href=\"\">". $foo ."</a>";
Edit, you said "fastest", which I overlooked
Assuming we are talking about PHP, specifically: Supposedly using the comma for string concatenation in php is one of the fastest ways to build a string. But unless you are doing this an awful lot, this seems like an optimization that won't buy you very much.
echo "<a href=\"\">", $foo ,"</a>";
<a href="..."> bla bla... <?php echo "string"; ?></a>