Skip to content

Instantly share code, notes, and snippets.

@flotwig
Created August 29, 2012 02:48
Show Gist options
  • Save flotwig/3506329 to your computer and use it in GitHub Desktop.
Save flotwig/3506329 to your computer and use it in GitHub Desktop.
fun
<?php
ini_set('xdebug.max_nesting_level', 10000000000000000000000000000000);
$set = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','1','2','3','4','5','6','7','8','9','0','@','!','#','$','%','^','&','*','(',')','-',' ','+','-');
$set = array_merge($set,$set,$set,$set,$set,$set,$set,$set,$set,$set,$set,$set,$set,$set,$set,$set,$set,$set);
$results = array();
gen_nos($set,$results);
function gen_nos(&$set, &$results) {
for($i=0; $i<count($set); $i++) {
$results[] = $set[$i];
$tempset = $set;
array_splice($tempset, $i, 1);
$tempresults = array();
gen_nos($tempset, $tempresults);
foreach($tempresults as $res) {
$results[] = $set[$i] . $res;
echo $set[$i] . $res . PHP_EOL;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment