Extract text from specific HTML tag : <p>I'm coding little script and I've faced this problem</p>

<p>now I have this HTML code</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="domains"&gt;
							&lt;ul&gt;
		&lt;li class="noMessages"&gt;
&lt;a href="select-admin-domain.do?domain=ex1.com"&gt;ex1.com&lt;/a&gt;
										&lt;/li&gt;
&lt;li class="noMessages"&gt;
&lt;a href="select-admin-domain.do?domain=ex2.com"&gt;ex2.com&lt;/a&gt;
						&lt;/li&gt;
&lt;li class="cpCurrentDomain noMessages"&gt;
&lt;a href="select-admin-domain.do?domain=ex3.com"&gt;ex3.com&lt;/a&gt;
						&lt;/li&gt;
&lt;li class="noMessages"&gt;
&lt;a href="select-admin-domain.do?domain=ex4.com"&gt;ex4.com&lt;/a&gt;
										&lt;/li&gt;
								
							&lt;/ul&gt;
						&lt;/div&gt;</code></pre>
</div>
</div>

now i want to extract the text from all this html tag using PHP</p>

<pre><code>&lt;a href="select-admin-domain.do?domain=ex1.com"&gt;ex1.com&lt;/a&gt;
&lt;a href="select-admin-domain.do?domain=ex2.com"&gt;ex2.com&lt;/a&gt;
&lt;a href="select-admin-domain.do?domain=ex3.com"&gt;ex3.com&lt;/a&gt;
&lt;a href="select-admin-domain.do?domain=ex4.com"&gt;ex4.com&lt;/a&gt;
</code></pre>

<p>so the output become 
ex1.com
ex2.com
etc..</p>

<p>i've make this code</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
function GetStr($string,$start,$end){
    
        
    
    $str = explode($start, $string);
    $str = explode($end, $str[1]);
    echo $str[0];
    
    
}
$ss= getStr($htmlcode,'&lt;a href="select-admin-domain.do?domain=','"&gt;');

echo $ss;</code></pre>
</div>
</div>
</p>

<p>it works good but it only gives me  the first output
ex1.com
and I want to echo all of them not just 1</p>
