Skip to content

Instantly share code, notes, and snippets.

@klaasvw
Created November 9, 2012 08:57
Show Gist options
  • Save klaasvw/4044592 to your computer and use it in GitHub Desktop.
Save klaasvw/4044592 to your computer and use it in GitHub Desktop.
Non breaking space, decode_entities and strtotime
<?php
// Replace &nbsp; by a space because decode_entities will replace it by
// ASCII code 160. See http://php.net/manual/en/function.html-entity-decode.php.
// Replacing chr(160) afterwards results in an unknown char for some
// reason.
// Note that strtotime will result in FALSE if ASCII code 160 is present in the string.
$value = str_replace('&nbsp;', ' ', $value);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment