Avatar of Bruce Gust
Bruce Gust
Flag for United States of America asked on

How would I write a for loop within a for loop and get this result?

Here's the tongue twister:

I'm doing a for loop and I get this result:

Florida
Louisiana
Texas
Kentucky

What I need to do is go through that for loop and WITHIN that same cycle do something like this:

First, here's my starting point:

foreach($page_display as $page)
{
//normal listing of results like what you see
}

Now, here's what I need to do:

foreach($page_display as $page)
{
   foreach($page_display as $page)
   {
   if($current_state <> $page['state']
      {
       //here I need to create a list of every state EXCEPT the one, so, in this scenario, I need four different recordsets:
       #1
       Louisiana
       Texas
       Kentucky
       #2
        Florida
        Texas
        Kentucky
       #3
       Florida
       Louisiana
       Kentucky
      #4
      Florida
      Louisiana
      Texas
      }
   }
}

How would I do this?
PHP

Avatar of undefined
Last Comment
hielo

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
hielo

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy