I have two arrays arr1 is 2015,03,12
and arr2 is 2015,03,12

how to compare i tryied like this
first method

{ alert("same");} else { alert("not same");}

i got not same. please help me anybody.

second method

var dd1 = arr1[2];
var mm1 = arr1[1];
var yy1 = arr1[0];

var dd2 = arr2[2];
var mm2 = arr2[1];
var yy2 = arr2[0];

if(dd2==dd1 && mm2==mmm1 && yy2==yy1){alert("same");}

both methods not working .

any body help me

Try use array_diff


// returned Array ( [2] => 12 )



// returned Array ( )

then we can use if(empty($result)) to check if the array is different.

Very Gud afternoon.

But tried in javascript.

please help me how to solve this problem in javascript

But you posted in PHP section...Is jquery okie for you? As I done some googling and found this jquery code

var diff = $(old_array).not(new_array).get();

and you can check if the diff is emptied also

Member Avatar


Moving to js....

Hi Friend very Thanks problem is solved.

Very Very Thanks