note 98344 added to language.types.array
| From: | william at cycronsystems dot com | Date: | Wed, 09 Jun 2010 23:26:02 +0000 |
| Subject: | note 98344 added to language.types.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-170003@lists.php.net to get a copy of this message | ||
I couldn't find a way to Trim an array in PHP so i wrote this little function that seemed to do
the trick. It will trim the 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;
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 173.196.139.66
----
Manual Page -- http://www.php.net/manual/en/language.types.array.php
Edit -- https://master.php.net/note/edit/98344
Del: integrated -- https://master.php.net/note/delete/98344/integrated
Del: useless -- https://master.php.net/note/delete/98344/useless
Del: bad code -- https://master.php.net/note/delete/98344/bad+code
Del: spam -- https://master.php.net/note/delete/98344/spam
Del: non-english -- https://master.php.net/note/delete/98344/non-english
Del: in docs -- https://master.php.net/note/delete/98344/in+docs
Del: other reasons-- https://master.php.net/note/delete/98344
Reject -- https://master.php.net/note/reject/98344
Search -- https://master.php.net/manage/user-notes.php