From: "Dan Anderson" <[EMAIL PROTECTED]>
> I want to do:
> 
> <?php
> 
> $array['element1'] = 'element1';
> $array['element2'] = 'element2';
> 
> foreach ($array as $element)
> {
>   // assuming get_assoc gets the assosciative name
>   if (get_assoc($element) == 'element1')
>     {get_assoc($element) do_something(); }
>   elseif ( == 'element1')
>     { do_somethingelse(); }
> }
> 
> ?>

Refer to the manual:

foreach($array as $key => $value)

So...

foreach($array as $key => $element)
{
  if($key == 'element1' ...
  if($key == 'element2' ...

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to