} $i += 6; } $hasonlitas = 2; foreach ($prim2 as $pri) { if (sameNum2((string) $pri, $hasonlitas)) { $prim[] = $pri; } } $n = count($prim); for ($i = 0; $i < $n; $i++) { $hossz = strlen((string) $prim[$i]); $j = $i + 1; $tomb[] = $prim[$i]; while ($j < $n && strlen((string) $prim[$j]) == $hossz) { if (Compare((string) $prim[$i], (string) $prim[$j], $hasonlitas)) { $tomb[] = $prim[$j]; } $j++; } if (sameNum((string) $prim[$i], $hasonlitas, $hol) && count($tomb) >= 8) { echo $prim[$i] . " tartozok: "; foreach ($tomb as $elem) { if (sameNumWhere((string) $elem, $hol)) { echo $elem . " "; } } echo "<br>"; } unset($tomb); }
/** * (macro) HasElements * Allows to check if an array if multiple elements */ function HasElements($array, $elements, $match = false) { foreach ($elements as $key => $value) { $key = is_numeric($key) ? $value : $key; if (!isset($array[$key])) { return false; } if ($match && !Compare($array[$key], $value)) { return false; } } return true; }