Posted By

MaxHudson on 02/06/13


Tagged

array function if


Versions (?)

Check if arrays equal each other


 / Published in: PHP
 

Checks if two given arrays equal each other as php doesn't have a built in function for this.

  1. function arraysEqual(arr1, arr2) {
  2. if(arr1.length !== arr2.length)
  3. return false;
  4. for(var i = arr1.length; i--;) {
  5. if(arr1[i] !== arr2[i])
  6. return false;
  7. }
  8. return true;
  9. }

Report this snippet  

You need to login to post a comment.