I have two arrays. They seem to contain at least one identical set of values, but performing array_diff()
does not return anything even though I think it should!
After converting both strings to hex-escaped form using
var_dump(preg_replace_callback('#.#', function($m) {
return '\\x' . dechex(ord($m[0]));
}, $input))
, the result strings appear like this: http://jsfiddle.net/mgaWn/
Looking at them in that form shows that the first string contains 5,·6·+·Extras
, the second one contains 5,·6··+·Extras
- there's a double space before the +
sign.
HTML collapses whitespace and this difference becomes completely invisible. It is generally a good idea to compare the data as close to its original format as possible, before any output format specifics (such as character encodings or this HTML whitespace minimization) get in your way.