-1

When i use array_diff() functions like; $result = array_diff($array1, $array2);

It turns like; Array( [5] => XXXXXX )

But i dont want to show " Array ( "index here" ) ", only XXXXX part. How can i show only XXXXX? Thanks for every comments...

2

1 Answer 1

4

Obtain the first element that is different -or- NULL if there is no difference.

list($result) = array_values(array_diff($array1, $array2)) + [NULL];

You can do:

var_dump($result);

See Demo.

To just out put the value you can do:

foreach($result as $value){
    echo $value;
}
2
  • it shows only one difference. For example: eval.in/4599 Commented Dec 13, 2012 at 20:38
  • Try this eval.in/4804 Commented Dec 17, 2012 at 0:29

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.