List:General Discussion« Previous MessageNext Message »
From:Pushkar Pradhan Date:June 5 2002 5:29pm
Subject:Re: [PHP] Comparing array elements
View as plain text  
You can use in_array or array_search.
> hey everyone,
>
> Does anyone have and ideas of wisdom on how to compare arrays (mysql result
> sets) and group items based on if they exist in two or more arrays?
>
> For example:
>
> I have a table, with a list of servers:
> server1
> server2
> server3
> server4
> server5
> ...
> serverX
>
> I have a table that specifies which of the servers are grouped:
> group1
>   server1
>   server4
>   server5
>
> Now, I want to compare group1 against the server list, and do something like
> the following:
> In group:
>   server1
>   server4
>   server5
>
> Not in group:
>   server2
>   server3
>   serverX
>
>
> <query>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan

Thread
Comparing array elementsChris Knipe5 Jun
  • Re: [PHP] Comparing array elementsPushkar Pradhan5 Jun
  • Re: Comparing array elementsDan Nelson5 Jun
  • Re: Comparing array elementsChris Knipe5 Jun