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?
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);
?>