Re: How to reduce an array to n values?

From: Date: Sun, 24 Mar 2002 13:53:40 +0000
Subject: Re: How to reduce an array to n values?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-89909@lists.php.net to get a copy of this message
^thanx. "Jacob Wyke" <kettle_drum@yahoo.com> schrieb im Newsbeitrag news:JKEBIMHMNHENELBDOPCIMEIKCDAA.kettle_drum@yahoo.com... > Use array_slice(). > > $output = array_slice ($input, 0, 3); > > will return the first three values of the array. > > Check out http://www.php.net/manual/en/function.array-slice.php > for more > details. > > > > -----Original Message----- > From: Andy [mailto:news.letters@gmx.de] > Sent: 24 March 2002 12:31 > To: php-general@lists.php.net > Subject: [PHP] How to reduce an array to n values? > > > Hi there, > > I am trying to reduce an array to n values if it is more than n values. > > eg. > > $level_depth = 3; > $test = array('banana', 'super', 'php', 'car'); > > # some array function which is deleting the last item ( car) if existant > > Thanx for any help, > > Andy > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > _________________________________________________________ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com >

« previous php.general (#89909) next »