//search for dns zone rec ip in ip_array tale if (is_numeric($hit) && $hit >= 0) { //do nothing, it's good. } else { ///we don't have a hit, the IP in the dns zone rec is not in the current good ip list and needs to be altered //find IP that is in good ip list but not in the current dns zone rec while ($end == false) { $ip_search = $ip_array[$i6]["ip"]; //get $i6 in ip list ($i6 will start at 0 and will be incremented on fail) $hit_search_dns = array_search($ip_search, array_column($dns_zone_array, 'ip')); // search that IP in DNS array if ($hit_search_dns == false) { $dns_bool = is_bool($hit_search_dns); //so we check if it's a real bool if ($dns_bool) { $write_edit = $cf->rec_edit($domain, $type, $id_entry, $name, $ip_search); //write it $end = true; //stop searching } } if ($i6 > $ip_array_available) { $end = true; // no more IPs available } $i6++; //keep looking for ip } } $i++; }