<?php
$dots = [];
for ($i=0; $i<=4; $i++) {
}
for ($i=0; $i<count($dots)-1; $i++) { for ($j=$i+1; $j<count($dots); $j++) { $x0 = $dots[$i][0];
$x1 = $dots[$j][0];
$y0 = $dots[$i][1];
$y1 = $dots[$j][1];
$disstance = sqrt(pow($x0-$x1, 2) + pow($y0-$y1, 2));
if (($i == 0) and ($j == 1)) {
$minDisstance = $disstance;
} elseif ($disstance < $minDisstance) {
$minDisstance = $disstance;
}
echo "($x0 $y0) : ($x1 $y1) - $disstance\n";
}
}
echo "минимальное расстояние между точками - " . $minDisstance;
//var_dump($ranges);
PD9waHAKZXJyb3JfcmVwb3J0aW5nKC0xKTsKCiRkb3RzID0gW107CmZvciAoJGk9MDsgJGk8PTQ7ICRpKyspIHsKCSRkb3RzW10gPSBbbXRfcmFuZCgwLDIwKSxtdF9yYW5kKDAsMjApXTsKfQoKCgpmb3IgKCRpPTA7ICRpPGNvdW50KCRkb3RzKS0xOyAkaSsrKSB7Cglmb3IgKCRqPSRpKzE7ICRqPGNvdW50KCRkb3RzKTsgJGorKykgewoJCSR4MCA9ICRkb3RzWyRpXVswXTsKCQkkeDEgPSAkZG90c1skal1bMF07CgkJJHkwID0gJGRvdHNbJGldWzFdOwoJCSR5MSA9ICRkb3RzWyRqXVsxXTsKCQkkZGlzc3RhbmNlID0gc3FydChwb3coJHgwLSR4MSwgMikgKyBwb3coJHkwLSR5MSwgMikpOwoJCQoJCWlmICgoJGkgPT0gMCkgYW5kICgkaiA9PSAxKSkgewoJCQkkbWluRGlzc3RhbmNlID0gJGRpc3N0YW5jZTsKCQl9IGVsc2VpZiAoJGRpc3N0YW5jZSA8ICRtaW5EaXNzdGFuY2UpIHsKCQkJJG1pbkRpc3N0YW5jZSA9ICRkaXNzdGFuY2U7CgkJfQoJCQkKCQllY2hvICIoJHgwICR5MCkgOiAoJHgxICR5MSkgLSAkZGlzc3RhbmNlXG4iOwoJfQp9CmVjaG8gItC80LjQvdC40LzQsNC70YzQvdC+0LUg0YDQsNGB0YHRgtC+0Y/QvdC40LUg0LzQtdC20LTRgyDRgtC+0YfQutCw0LzQuCAtICIgLiAkbWluRGlzc3RhbmNlOwovL3Zhcl9kdW1wKCRyYW5nZXMpOw==