Re: Array's
| From: | Jamie Shields | Date: | Fri, 28 Jul 2000 08:46:19 +0000 |
| Subject: | Re: Array's | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-8735@lists.php.net to get a copy of this message | ||
Or instead of "each", you could use this:
$required_name = "Dane";
for ($i = 0; $i < count(My_Array); $i++) {
if (My_Array[$i] == $required_name) {
echo "Dane is in Element " . $i . ".\n";
}
}
On 27 Jul 00, at 22:31, Nathan Purciful wrote:
> How would i go about doning this?
>
> ----- Original Message -----
> From: "David Robley" <huntsman@www.nisu.flinders.edu.au>
> To: <npurciful@hotmail.com>
> Cc: <php-general@lists.php.net>
> Sent: Thursday, July 27, 2000 10:39 PM
> Subject: Re: [PHP] Array's
>
>
> > On 27 Jul, Nathan Purciful wrote:
> > > Ok I have a array and i want to go to the next element in the list how
> do i
> > > get it to know what element it is
> > >
> > > My Array = Nathan,Dane,Purciful
> > >
> > > I need to seek to element 'Dane' how do i do this?
> > >
> >
> > If you are looking for a specific value in an array element you could
> > traverse the array using each() and test each element until you find the
> > required value.
> >
> > Cheers
> > --
> > David Robley | WEBMASTER & Mail List Admin
> > RESEARCH CENTRE FOR INJURY STUDIES |
> > http://www.nisu.flinders.edu.au/
> > AusEinet |
> > http://auseinet.flinders.edu.au/
> > Flinders University, ADELAIDE, SOUTH AUSTRALIA
> >
> >
>
------------------------------
Jamie Shields
Deputy Computing Officer
Computer Resources Centre
Faculty of Human Sciences
Kingston University
Phone: (0181) 547-2000 ex:2367
http://humansciences.king.ac.uk
------------------------------