首页 技术教程 实用代码 注册破解 正则表达式 网址导航 电子书籍

PHP实现的字典序排列算法

<?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 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."<br>"; for ($j=$s-1; $i < $j; $i++, $j--)...
类别:网页编程 - PHP技术    查看:126    更新:2014-05-19