note 102631 deleted from function.array-slice by danbrown
[email protected] Fri, 25 Feb 2011 06:33:20 -0800
| Newsgroups | php.notes |
|---|---|
| Message-ID | <[email protected]> |
Note Submitter: rehnahmed [at] gmail [dot] com
----
Best function to slice an array in two parts.
function chopArray($result, $start, $end)
{
$i = 1;
$outcome = array();
foreach($result as $res)
{
if($i >= $start && $i <= $end )
$outcome = $res;
$i++;
if($i > $end)
break;
}
return $outcome;
}
Hope it will help you.