Skip to content

Instantly share code, notes, and snippets.

@yehchge
Last active May 9, 2019 06:46
Show Gist options
  • Save yehchge/80afe8651ff511e86e7095e05a588f84 to your computer and use it in GitHub Desktop.
Save yehchge/80afe8651ff511e86e7095e05a588f84 to your computer and use it in GitHub Desktop.
php file
<?php
/**
* Replace non-breaking spaces with normal spaces
*
* @param $str
* @return string
*/
function removeNbsp($str)
{
$str = trim($str);
$str = preg_replace('/&nbsp;/is',' ', $str);
$str = html_entity_decode($str);
return $str;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment