split link string
<p>I have a link that looks like this:
<br /><code>&lt;a href="/site/cdb/index.php?adinfo=272"&gt;Company Inc.&lt;/a&gt;</code></p>

<p>I want to split it so I remain with two pieces of information, the value of adinfo, in the example <strong>272</strong>, and the linking words, in the example <strong>Company Inc.</strong>.</p>

<p>I can do it with the code below but that is six lines of code which chops the string in to bits and I find it quite ugly, so I was wondering if there is an easier/nicer way.</p>

<pre><code>$str = right($str, strlen($str)-36);
$pos = strpos($str, '"');
$value = left($str, $pos);
$str = right($str, strlen($str)-($pos+2));
$pos = strpos($str, '&lt;/a&gt;');
$link = left($str, $pos);
</code></pre>

<p>(left and right are functions of my own that keep the left or right part of a string and cut of the rest)</p>
