<?php
Header("Content-Type: text/html;charset=UTF-8");
function CompareArray($array_1, $array_2)
{
foreach ($array_1 as $value_1) {
$skip = False;
foreach ($array_2 as $key => $value_2) {
if ($value_1 == $value_2) {
$skip = True;
break;
}
}
if ($skip==False) {
$result_array[] = $value_1;
}
}
//сливаем результирующий массив с оставшимися значениями второго массива
// Вывод
echo "Результат сравнения:<br>";
for ($i=0; $i < count($result_array); $i++) { echo $result_array[$i].'<br>';
}
}
$array_1 = array('kartoshka', 'banana', 'Агент 007', 'Чай', 'Stephen Hawking'); $array_2 = array('banana', 'Яблоко', 'Яблоко', 'kartoshka', 'Агент 007', '404: string_not_found' );
CompareArray($array_1,$array_2);
?>
PD9waHAgCgpIZWFkZXIoIkNvbnRlbnQtVHlwZTogdGV4dC9odG1sO2NoYXJzZXQ9VVRGLTgiKTsKCmZ1bmN0aW9uIENvbXBhcmVBcnJheSgkYXJyYXlfMSwgJGFycmF5XzIpCnsKCgkkcmVzdWx0X2FycmF5ID0gYXJyYXkoKTsKCQoJZm9yZWFjaCAoJGFycmF5XzEgYXMgJHZhbHVlXzEpIHsKCQkkc2tpcCA9IEZhbHNlOwoJCWZvcmVhY2ggKCRhcnJheV8yIGFzICRrZXkgPT4gJHZhbHVlXzIpIHsKCQkJaWYgKCR2YWx1ZV8xID09ICR2YWx1ZV8yKSB7CgoJCQkJJHNraXAgPSBUcnVlOwoKCQkJCXVuc2V0KCRhcnJheV8yWyRrZXldKTsKCQkJCWJyZWFrOwoJCQl9CgkJfQoJCWlmICgkc2tpcD09RmFsc2UpIHsKCQkJJHJlc3VsdF9hcnJheVtdID0gJHZhbHVlXzE7CgkJfQoJfQoKCS8v0YHQu9C40LLQsNC10Lwg0YDQtdC30YPQu9GM0YLQuNGA0YPRjtGJ0LjQuSDQvNCw0YHRgdC40LIg0YEg0L7RgdGC0LDQstGI0LjQvNC40YHRjyDQt9C90LDRh9C10L3QuNGP0LzQuCDQstGC0L7RgNC+0LPQviDQvNCw0YHRgdC40LLQsAoJ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