mysql - How to remove hidden characters from text string in PHP? -


i having difficulty match 2 text strings. 1 contains hidden characters text string.

i have text string: "pr & communications" stored on sql database. when pulled there, $database_version, var_dump($database_version) reveals string have 19 bytes.

i have scraped (with permission) website, text variable, $web_version. ostensibly string "pr & communications" not match database version, i.e if($database_version == $web_version) not true.

var_dump() reveals $web_version have 23 bytes. trim() has no effect, nor strip_tags() preg_replace( '/[^\pc\s]/u', $web_version ) removes because afterwards string_var($web_version) reveals string comprise 14 bytes only. has removed something, possibly much, string still not match $database_version.

any ideas how to:

  1. find out has been removed
  2. strip out enough match $database_version?

ps don't know how view variable in hexadecimal code

$trimmedval = preg_replace("/\s+|[[:^print:]]/, "", $value) 

trim() removes " \t\n\r\0\x0b" (see docs), use snippet above remove non-printed characters string.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -