if ($_post["perdata"] = = "")
{
$_post["Perdata"] = "1 2 3 4";
}
$data = Chop (Trim ($_post["perdata"));
$a = Explode ("", $data);
Sort ($a);
$data = Implode ("", $a);
?>
Function Nextpermu (& $c)
{
$s = sizeof ($c);
$i = $s-1;
while ($i > 0)
{
if ($c [$i] > $c [$i-1])
{
$j = $s-1;
while ($c [$j] <= $c [$i-1])
$j--;
$t = $c [$i-1];
$c [$i-1] = $c [$j];
$c [$j] = $t;
echo $i. " -". $j."
";
for ($j = $s-1; $i < $j; $i, $j-)
{
$t = $c [$i];
$c [$i] = $c [$j];
$c [$j] = $t;
}
return true;
}
$i--;
}
for ($i = 0, $j = $s-1; $i < $j; $i, $j--)
{
$t = $c [$i];
$c [$i] = $c [$j];
$c [$j] = $t;
}
return false;
}
?>
<title>Permutation-Dictionary method</title>
Current element:
Serial Number |
Arrange |
|
|
$num;} while (NEXTPERMU ($a));? >
http://www.bkjia.com/PHPjc/631405.html www.bkjia.com true http://www.bkjia.com/PHPjc/631405.html techarticle php if ($_post[perdata] = =) {$_post[perdata] = 1 2 3 4;} $data = Chop (Trim ($_post[perdata])); $a = explode (, $ data); Sort ($a); $data = implode (, $a);?? PHP function Nex ...