Sunday 15 September 2013

php - array_diff does not show the difference -


I am trying to compare two arrays using this code:

  $ Diff = array_diff ($ selected, $ checkbox); Echo '& lt; Br> Selected:'; Print_r ($ selected); Echo & lt; Br> Original: '; Print_r ($ check box); Echo & lt; Br> Difference: '; Print_r ($ difference);   

This is strange, though it is the result of the following:

  selected: Array ([0] = & gt; Forums 1 [1] = & Gt; Forum 3 [2] => Furniture) Origin: Array ([0] => Forums 1 [1] => 3 [2] => Forum 4 [3] = & Gt; Furniture [4] = & Nt; Nieuwforum Difference: Array ([0] = & gt; Forum 1 [1] => Forum 3 [2] => Furniture)   

It seems that the array_diff function only copies the 'selected' color. I have tried many things, where are posted in the same question like using array_IDIF_soc Received, but it does not matter.

Does anyone know what is wrong?

is mentioned as.

Returns an array containing all entries from array1 which is not present in any other array

  $ diff = array_diff ($ Checkbox, selected $);   



No comments:

Post a Comment