3
I have two arrays, I need to take each element of the second array and check if it is contained in any element of the first array using, for example, the strpos function().
I mean, I need to check if any string of the list 2 is contained in any URL list 1. Thanks in advance.
<?php
$ads = array();
$ads[0] = "https://superman.com.br";
$ads[1] = "https://photoshop.com.br?galid=";
$ads[2] = "https://mercado.com.br";
$ads[3] = "https://xdemais.com.br";
$ads[4] = "https://imagens.com.br";
$ads[5] = "https://terceiraidade.com.br";
$ads[6] = "https://goldenartesgraficas.com.br";
$ads[7] = "https://empregos.com.br";
$ads[8] = "https://umcentavo.com.br";
$ads[9] = "https://classificados.com.br";
$filter_ads = array();
$filter_ads[0] = "galid=";
$filter_ads[1] = "gslid=";
$filter_ads[2] = "ghlid=";
$filter_ads[3] = "gplid=";
$filter_ads[4] = "gulid=";
$filter_ads[5] = "gllid=";
$filter_ads[6] = "gklid=";
$filter_ads[7] = "grlid=";
$filter_ads[8] = "gwlid=";
$filter_ads[9] = "gelid=";
foreach($ads as $ads_x) {
if (strpos($ads_x, in_array($filter_ads, $ads))) {
echo "Existe";
}
}
?>
PERFECT!!! Thanks Thomas Lima, very grateful for the help.
– Valdiney Pereira