EchoFool Posted November 1, 2010 Share Posted November 1, 2010 Hey, I am using array diff to find numbers in one array that are not in another array. Yet it returns a value which is in another array which is annoying... my array structure is: Array( [0] => 06 [1] => 11) //this is TEMP Array( [0] => 2 [1] => 3 [2] => 5 [3] => 6 [4] => 6 [5] => 11 [6] => 11)//this is VALUES Now my returned difference should be: [0] => 2 [1] => 3 [2] => 5 // all numbers not in TEMP But i get: Array( [0] => 2 [1] => 3 [2] => 5 [3] => 6 [4] => 6)//6 IS in TEMP and should not appear 6 should not appear but it does....any one know why ? This is my code: $Temp = explode('+',$HandValue); $HighCard = array_diff($Values, $Temp); Any ideas? Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 1, 2010 Share Posted November 1, 2010 I suspect your problem lies in this paragraph: Two elements are considered equal if and only if (string) $elem1 === (string) $elem2. In words: when the string representation is the same. [/code] Quote Link to comment Share on other sites More sharing options...
EchoFool Posted November 1, 2010 Author Share Posted November 1, 2010 I don't follow ? Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted November 1, 2010 Share Posted November 1, 2010 06 !== 6 06 is not identical to 6 06 is not equal to 6 and/or 06 is not of the same type as 6 "06" is not "6" "06" is not 6 Quote Link to comment Share on other sites More sharing options...
EchoFool Posted November 1, 2010 Author Share Posted November 1, 2010 lol okay i get it now ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.