note 98343 added to language.oop5

From: Date: Wed, 09 Jun 2010 23:22:53 +0000
Subject: note 98343 added to language.oop5
Groups: php.notes 
Request: Send a blank email to php-notes+get-170002@lists.php.net to get a copy of this message
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. ---- Server IP: 69.147.83.197 Probable Submitter: 173.196.139.66 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.php Edit -- https://master.php.net/note/edit/98343 Del: integrated -- https://master.php.net/note/delete/98343/integrated Del: useless -- https://master.php.net/note/delete/98343/useless Del: bad code -- https://master.php.net/note/delete/98343/bad+code Del: spam -- https://master.php.net/note/delete/98343/spam Del: non-english -- https://master.php.net/note/delete/98343/non-english Del: in docs -- https://master.php.net/note/delete/98343/in+docs Del: other reasons-- https://master.php.net/note/delete/98343 Reject -- https://master.php.net/note/reject/98343 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#170002) next »