note 99360 rejected from function.rsort by danbrown
| From: | danbrown@php.net | Date: | Thu, 12 Aug 2010 15:51:10 +0000 |
| Subject: | note 99360 rejected from function.rsort by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-171618@lists.php.net to get a copy of this message | ||
Note Submitter: jamie at jgmcelwain dot com
----
Anyone got any ideas why this would display 1, then 10, then 2, then 20, then 3, then 30?
<?php function xfunction($page = 1, $num_posts = 5) {
$start = (($page - 1) * $num_posts);
$path = "content/posts/";
$files = glob("" . $path . "*.txt");
if ($files) {
rsort($files);
$files = array_slice($files, $start, $num_posts);
foreach ($files as $file) {
print("\n<article>");
include($file);
print("</article>\n");
}
} else {
echo "Somthing's Missing? Maybe you need to <a
href='install.php'>Install?</a>";
}
} ?>