Posted by Michael Fesser on 11/01/07 18:10
..oO(floortje)
>I agree .... there are ways to work around the problem.
>
>I could do something like:
>
>echo 'Last 5 entries';
>for ($i=count($allentries),$i>(count($allentries)-5);$i--)
>{
>echo $allentries[--$i].'<br />';
>}
>
>But It still bothers me that I cant simply extract 5 rows that have
>largest/smallest value in an array field from a multi dimentional
>array. Is there really no better way to do this ?
For extracting a part of an array there is array_slice(), which should
work for your latest entries. For getting the modified ones you could
sort the array with a user-defined comparison function and then use
array_slice() again. You could also try array_filter(). The callback
function just has to check if the entry was modified.
Micha
[Back to original message]
|