<?php
function number_sum($num)
{
return array_sum(str_split($num));
}
$sum = 28;
for ($b1 = 1; $b1 < 256; $b1++) {
for ($b2 = 0; $b2 < 256; $b2++) {
for ($b3 = 0; $b3 < 256; $b3++) {
for ($b4 = 0; $b4 < 256; $b4++) {
if ((
number_sum($b1) +
number_sum($b2) +
number_sum($b3) +
number_sum($b4)
) == $sum) {
echo "$b1.$b2.$b3.$b4" . PHP_EOL;
}
}
}
}
}