The below does not remove the control characters as the site examples show.
I was doing it to the $HTTP_POST_VARS, with a whole lot more functionality, but I
can't ANY thing
to modify the string below ........ :-(
Anyone got any ideas why this does not print a string trimmed of all the \t,\r,\n
characters?
(And I haven't even begun to deal with the 'reference' issues)
========================================================================================
<?php
echo("<pre>\n");
function clean_gpc( &$x ) {
echo("<br>\nIN
FUNCTION--------------------------------------------------------------------");
echo( trim($x,"\x00..\x20") . "<br>\n" );
// supposedly trims all control codes and spaces from ends of string
echo("<br>\nOUT
FUNCTION--------------------------------------------------------------------");
}
$bad_str = " \t\t\t\\r\\\r\r\r\r\n\r\nFour schore
...........and seven
\n\n\n\n\nr\r\r\rn\r years ago, ,,,,,,, ,,,,,,,our father created on tis planet
\t\t\t\\r\\\r
\r\r\r\n\r\nFour ";
echo("<pre>\n");
clean_gpc( $bad_str );
echo("</pre>\n");
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php