- trim: documentation ( source)
- html_entity_decode: documentation ( source)
<?php
$a = html_entity_decode('ABC ');
$b = 'ABC ';
echo 'Length with trim and nbsp: '.strlen(trim($a)).PHP_EOL;
echo 'Length with trim and space: '.strlen(trim($b)).PHP_EOL;
echo 'Length with mb_trim and nbsp: '.strlen(mb_trim($a)).PHP_EOL;
echo 'Length with mb_trim and space: '.strlen(mb_trim($b)).PHP_EOL;