Jump to content

[SOLVED] Limit results in an array?


acook

Recommended Posts

I have an array.  I'd like to know if there's any way to limit the results it outputs to 10?  Here's the array...

 

$results_array4 = array();

while(odbc_fetch_into($result4, $d))
{
    $results_array4[$d[1]] = $d[0];                    }

foreach ($results_array4 as $gp4 => $count4)
{

    echo "<tr><td>$count4</td><td>$gp4</td></tr>";
}

 

 

I tried throwing something like:

 

$arraycount = count($results_array4);

while ($arraycount < 10){
}

 

But it didn't work.  Is what I'm trying to do possible? 

Link to comment
https://forums.phpfreaks.com/topic/88748-solved-limit-results-in-an-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.