tags:

views:

36

answers:

2

I have a big array which i need to display the latest 10 items in it only. what is the best php code to do that?

thanks

+4  A: 

Use array_slice

$printing = array_slice($array, -10);

print_r($printing); //or however you want to print it.
Yacoby
+1  A: 
foreach( array_slice( $array, -10 ) as $k => $v ) {
    echo $v;
}
Galen