I am a newbie in PHP in general and I have a task in which I need to make it so that the "filtered" array of links is displayed (that is, without repetitions, I use array_unique ). But when I deduce one array, all the same there are repeating links. I do not understand what I'm doing wrong, please tell me!
<?php include_once('simple_html_dom.php'); $site='http://www.bonprix.ua'; $html = file_get_html('http://www.bonprix.ua'); foreach($html->find('a') as $element){ $str = $element->href; $str4 = substr($str, 0, 4); $arr_1 = array(); $arr_2 = array(); if ($str4 == 'http') {array_push($arr_1, $str. '<br>');} else {array_push($arr_2, $site.$element->href. '<br>');} $result = array_unique($arr_1); foreach($result as $value){echo $value;} } ?>