<?php
    
if (isset($_POST['a'])){
        echo 
"\$_POST[a]: '$_POST[a]'<br />\n";
        
//if your browser encodes &nbsp; in a VALUE as some other extended ASCII char than 160, add that into the mix
        
for ($i 0$i strlen($_POST['a']); $i++){
            echo 
"$i: "$_POST['a'][$i], " ("ord($_POST['a'][$i]), ")<br />\n";
        }
        echo 
"str_replace: '"str_replace('&nbsp;'''$_POST['a']), "'<br />\n";
        echo 
"trim: '"trim(str_replace('&nbsp;'''$_POST['a']), " \r\n\t\0" chr(160)), "'<br />\n";
    }
?>
<form method="post" action="">
    <input type="submit" name="a" value="&nbsp; &nbsp; &nbsp;A&nbsp; &nbsp &nbsp;" />
</form>
<a href="index.phps" target="_blank">source</a>