Comparing two arrays
From: John Smith (kevin4205_at_comcast.net)
Date: 02/25/05
- Next message: Michael Fesser: "Re: Entity"
- Previous message: Marcos: "Entity"
- Next in thread: Michael Fesser: "Re: Comparing two arrays"
- Reply: Michael Fesser: "Re: Comparing two arrays"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 25 Feb 2005 05:58:12 -0800
I got stuck on this and my brain is not working correctly. I am somewhat new
at PHP, and programming in general, so that is my excuse.
I am making an online reservations web page.
I have an array $rooms that has a list of room numbers.
I have another array $taken that has a list of the rooms that are not
available.
I want to find out which rooms are available by subtracting the items in the
$taken array from the $rooms array.
For instance,
If rooms has 1, 2, 3, 4, 5, 6, 7, 8
And the taken array has 3, 5, 8
How do I write the code so that I end up with an array called $available
that would have the remaining rooms 1, 2, 4, 6, 7?
Any help would be tremendously appreciated.
Thanks,
Kevin
- Next message: Michael Fesser: "Re: Entity"
- Previous message: Marcos: "Entity"
- Next in thread: Michael Fesser: "Re: Comparing two arrays"
- Reply: Michael Fesser: "Re: Comparing two arrays"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|