Created
March 10, 2022 04:45
-
-
Save simplyniceweb/237e2a14d42d95f2be3ea62aa2eaabbc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$results = []; | |
function generator($number, $length) | |
{ | |
// check if odd | |
if($number % 2 != 0){ | |
$number = $number+1; | |
} | |
$result = $number/2; | |
// if the number given is lower than 10 | |
if ($result < 10) { | |
$result = "0$result"; | |
} | |
return substr($result, -$length); | |
} | |
$count = 52327; | |
while(count($results) < 100) { | |
$generator = generator($count, 2); | |
$results[$generator] = $generator; | |
$count++; | |
} | |
echo "<pre>"; | |
print_r($results); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment