Skip to content

Instantly share code, notes, and snippets.

@tolawho
Created August 16, 2019 12:33
Show Gist options
  • Save tolawho/cf805d0054cf3c1e95f4590ee9bf37dd to your computer and use it in GitHub Desktop.
Save tolawho/cf805d0054cf3c1e95f4590ee9bf37dd to your computer and use it in GitHub Desktop.
expendnumber.php
<?php
$ten = 10;
$max = 15;
$current = 0;
$step = 0;
for ($i = 1; $i <= $max; $i++) {
$b = $c = $i;
$d = $current * 10;
$count1 = $count2 = 0;
while ($b % 10 == 0):
$count1++;
$b /= 10;
endwhile;
while ($c / 10 > 1 ):
$count2++;
$c /= 10;
endwhile;
$diff = abs($count1 - $count2);
for ($k = 1; $k <= $diff; $k++) {
$d *=10;
}
$current = $i + $d;
}
echo $current;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment