Wednesday, September 3, 2008

Remove White Spaces using php

<?php
//The hex codes are space, tab, line feed, vertical tab, form feed, carriage return
 $whitespace ="";
 $teststring = "Charit&#x00E9;-Universit&#x00E4;; " ;
// $result = ereg ("[[:space:]]&([#]?[a-zA-Z0-9]*)?;", $teststring);
$teststring =ereg_replace("[[:space:]]\&([#]?[a-zA-Z0-9]*)?;","&#160;\\0", $teststring);
echo $teststring;
//Prints Matches 11 characters
?>

No comments:

Post a Comment