Jump to content

equals all array

- - - - -

  • Please log in to reply
2 replies to this topic

#1
lol33d

lol33d

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
Hello

how to check equals arrays?

for ex:
$t1 = array("G", "G", "G", "G", "G");
is true
and
$t2 = array("G1", "G", "G", "G", "G");
is false


thank you

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
Feel free to look at the array functions available:
PHP: Array Functions - Manual

You could utilize array_diff of which will return an array (either with zero or more elements) which can determine if there is a unique value in one of the arrays. You could certainly count() the result to check for the amount of different elements on this simple array.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
rhossis

rhossis

    Learning Programmer

  • Members
  • PipPipPip
  • 46 posts
You could also look at array_unique() function




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users