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