I have this little script with an example:
The two string, where I want to get the different numbers
$first = "|x|67|x|194|x|113|x|6|x|";
$second = "|x|194|x|113|x|6|x|109|x|";
Explode them, to get the pure numbers
$first_array = explode("|x|", $first);
$second_array = explode("|x|", $second);
Get the difference
$result_array = array_merge(array_diff($first_array, $second_array), array_diff($second_array, $first_array));
See the result
$result = implode(",", $result_array);
My question is:
How to get which number is added and which removed from the first string?