<?php
10,
20,
100,
30,
40,
104,
200,
202,
33
);
$lastValue1 = $mass[0];
$lastValue2 = $mass[1];
$lastDef = abs($mass[0] - $mass[1]); $k = 1;
for ($i = 1; $i < count($mass); $i++) { $k = 0;
do {
$def = abs($mass[$k] - $mass[$i]);
if ($def == 0) {
continue;
}
if ($def < $lastDef) {
$lastDef = $def;
$lastValue2 = $mass[$k];
$lastValue1 = $mass[$i];
}
$k++;
} while ($k < $i);
}
echo "$lastValue1<br>";
echo "$lastValue2<br>";
PD9waHAKJG1hc3MgICAgICAgPSBhcnJheSgKICAgIDEwLAogICAgMjAsCiAgICAxMDAsCiAgICAzMCwKICAgIDQwLAogICAgMTA0LAogICAgMjAwLAogICAgMjAyLAogICAgMzMKKTsKJGxhc3RWYWx1ZTEgPSAkbWFzc1swXTsKJGxhc3RWYWx1ZTIgPSAkbWFzc1sxXTsKJGxhc3REZWYgICAgPSBhYnMoJG1hc3NbMF0gLSAkbWFzc1sxXSk7CiRrICAgICAgICAgID0gMTsKCmZvciAoJGkgPSAxOyAkaSA8IGNvdW50KCRtYXNzKTsgJGkrKykgewogICAgJGsgPSAwOwogICAgZG8gewogICAgICAgIAogICAgICAgICRkZWYgPSBhYnMoJG1hc3NbJGtdIC0gJG1hc3NbJGldKTsKICAgICAgICAKICAgICAgICBpZiAoJGRlZiA9PSAwKSB7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgIH0KICAgICAgICBpZiAoJGRlZiA8ICRsYXN0RGVmKSB7CiAgICAgICAgICAgICRsYXN0RGVmICAgID0gJGRlZjsKICAgICAgICAgICAgJGxhc3RWYWx1ZTIgPSAkbWFzc1ska107CiAgICAgICAgICAgICRsYXN0VmFsdWUxID0gJG1hc3NbJGldOwogICAgICAgIH0KICAgICAgICAkaysrOwogICAgfSB3aGlsZSAoJGsgPCAkaSk7CiAgICAKfQplY2hvICIkbGFzdFZhbHVlMTxicj4iOwplY2hvICIkbGFzdFZhbHVlMjxicj4iOw==