Thread: Compare arrays
View Single Post
  #2  
Old 08-30-2009, 09:14 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by DustyPorViva View Post
Is there a simple way to compare two arrays like so:
PHP Code:
array1 = {1,1};
array2 = {2,2};
if (
array1 == array2
Without running loops? Ideally I'm looking for a single if check like my example, but my attempts have proven unsuccessful. Is there one of those 'secrets' or is it just not possible?
I wonder if you could do something like

PHP Code:
if ((@ array1) == (@ array2)) {
  
// whatever

since @ converts arrays to strings. I know this works for some other stuff, such as "in" or "index".
__________________
Reply With Quote