I am having difficulty to match two text strings. One contains some hidden characters from a text string.
I have a text string: "PR & Communications" stored on an SQL database. When pulled from there, into $database_version, var_dump($database_version) reveals the string to have 19 bytes.
I have scraped (with permission) from a website, some text into a variable, $web_version. Ostensibly the string is "PR & Communications" but it does not match the database version, i.e if($database_version == $web_version) is NOT true.
var_dump() reveals $web_version to have 23 bytes. trim() has no effect, nor does strip_tags() but preg_replace( '/[^\PC\s]/u', $web_version ) removes something because afterwards string_var($web_version) reveals the string to comprise 14 bytes only. It has clearly removed something, possibly too much, as the string still does not match with $database_version.
Any ideas how to:
- find out what has been removed
- strip out just enough to match $database_version?
PS I don't know how to view the variable in hexadecimal code
utf8-decode($web_version)- php.net/manual/en/function.utf8-decode.php.var_dump($web_version, bin2hex($web_version), __FILE__.__LINE__);. To see what the character represent then: ASCII Table and Description and Complete Character List for UTF-8