note 98343 deleted from language.oop5 by danbrown
| From: | danbrown@php.net | Date: | Wed, 09 Jun 2010 23:27:23 +0000 |
| Subject: | note 98343 deleted from language.oop5 by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-170004@lists.php.net to get a copy of this message | ||
Note Submitter: william at cycronsystems dot com
----
I couldnt find a native way of trimming an array in PHP so I wrote a function to trim an array down
to a specified size.
<?php
//Utility Function to Trim Array
function trim_array(array $array,$int){
$newArray = array();
for($i=0; $i<$int; $i++){
array_push($newArray,$array[$i]);
}
return (array)$newArray;
}
?>
There might be a cleaner way but this worked for me.