How to find links to another domain?

In the array are strings of the form:
<a href="/onw">one</a>
<a href="twoo">one</a>
<a href="#">three</a>
<a href="">four</a>"
<a href="">five</a>"
<a href="">six</a>"

How to determine how many external links on a page is if the native domain known in advance?
Thought to find of the regular season something like
but failed to make the regular season
July 8th 19 at 15:21
2 answers
July 8th 19 at 15:23

Actually you can still find fault, to add a bunch of options, but for specific instances work.

July 8th 19 at 15:25
Yes, that's the regular season.
can be broken down into tasks.

foreach( $links as $link ){
 if( stripos( $link, $siteName ) === false ){
 if( preg_match('#^(http\:\/\/|https\:\/\/)#', $link) ){
 // Some actions

1. Check is enter the domain name of the website.
2. Check whether links to linked third party online and check the line beginning with http or https.
3. Do some operation.
stripos( $link, $siteName ) === false - this condition will display all the internal links - alva8 commented on July 8th 19 at 15:28
true that's why I can't immediately check the entry of the domain - Tyreek.Stoke commented on July 8th 19 at 15:31
stripos( $link, $siteName ) === false - this condition will display all the internal links
what? here the division of tasks, in order not to bathe with the regular season, the second step cut off everything that leads to other resources.
If purely by the regular season, without the hassle, then the solution has already shown Mikhail Osher - Kaylah_Mraz82 commented on July 8th 19 at 15:34

Find more questions by tags Regular expressionsPHP