i was wondering how you generate all binary combinations of a string x long, eg
$x = 3
so it would generate
000 001 010 011 100 101 110 111
any ideas?
Like:
$x=3; for($i=0; $i<(pow($x,2)-1); $i++) { $tmp = decbin($i); while(strlen($tmp) < $x) $tmp = "0".$tmp; echo $tmp."<br>"; }
?
i tried setting $x to 16 but it dies when it gets to 0000000011111110
Don't you think displaying 65,536 numbers is a bit obscene?
Can you tell us what the greater purpose/accomplishment of this script is going to be?
it has a use but im not going to disclose it at the moment!
i figured out how to do it tho, thanks