Re: How to reduce an array to n values?
| From: | Thalis A. Kalfigopoulos | Date: | Sun, 24 Mar 2002 20:05:08 +0000 |
| Subject: | Re: How to reduce an array to n values? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-89926@lists.php.net to get a copy of this message | ||
Use array_splice or better array_slice.
array_slice($orig_array,0,n);
cheers,
--t.
On Sun, 24 Mar 2002, [-^-!-%- wrote:
>
>
> Use array_pop.
> See the manual.
>
> -j
>
> __________John Monfort_________________
> _+-----------------------------------+_
> P E P I E D E S I G N S
> www.pepiedesigns.com
> -+___________________________________+-
>
> On Sun, 24 Mar 2002, Andy wrote:
>
> > 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
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>