How can I bruteForce a number? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 2

How can I bruteForce a number?

I wanted to upgrade my skillls in PHP by making a script that bruteForces a number, and the number should be from 0000000 to 9999999 and I don’t have any idea how I tried adding 1 to 0000000 to make the output 0000001 but it only outputs 1. can u suggest some ideas

1st Feb 2017, 10:46 PM
Mohammed Bermime
Mohammed Bermime - avatar
3 Antworten
+ 8
@Mario Laurisch wow php looks clunky
2nd Feb 2017, 12:23 AM
Ahri Fox
Ahri Fox - avatar
+ 6
for($a=0; $a<=9; $a++) { for($b=0; $b<=9; $b++) { ... for($f=0; $f<=9; $f++) { echo $a . $b . $c . ... . $f; }}}}}} hope that helps you to get the idea
1st Feb 2017, 10:58 PM
Mario L.
Mario L. - avatar
+ 2
for ($I=0;$I<=999999;$I++) { $paddedstr = str_pad($I, 7, '0', STR_PAD_LEFT); if (somecheck($paddedstr) == true) { return $paddedstr; } }
2nd Feb 2017, 5:01 AM
Dave Cha
Dave Cha - avatar