I have 2 arrrays, And i need return TRUE or FALSE when 2 arrays matched each other. also un-ordered arrays should return TRUE if results matched, but only should return true if both arrays have same values.
//This should return TRUE
$array_One = array('test1', 'test2', 'test3');
$array_Two = array('test1', 'test2', 'test3');
//This should return TRUE
$array_One = array('test1', 'test2', 'test3');
$array_Two = array('test1', 'test3', 'test2');
//This should return TRUE
$array_One = array('test1', 'test2', 'test3');
$array_Two = array('test1', 'test3', 'test2');
//This should return FALSE
$array_One = array('test1', 'test2', 'test3');
$array_Two = array('test1', 'test2');
I tried few methods, including array_key_exists by using foreach, But it does not returned the expected result. This should return ONLY one TRUE or FALSE when arrays matched.
http://php.net/manual/en/function.array-diff.php
If you just need to know if two arrays’ values are exactly the same (regardless of keys and order), then instead of using array_diff, this is a simple method: