检查不同数组或变量上的相同值

I have 2 variables of equal value:

    $word1 = 'a, b, c, d';
    $word2 = 'b, c, d, a';

I want to check whether the two variables have exactly the same value. How to check it?

You could use array_dif()

Example

<?php

$word1 = 'a, b, c, d';
$word2 = 'b, c, d, a';

$array1 = explode(', ', $word1);
$array2 = explode(', ', $word2);
$result = array_diff($array1, $array2);

print_r($result);

?>

Live example

using this code you have to get same value in array

 <?php

 $word1 =array('a, b, c, d');
 $word2 =array('b, c, d, a');
 $data = array_intersect($word1, $word2);

  ?>