Hi Abhijit,
To do this, use the chop function.
If you have just read about the trim function, then this example will illustrate the difference between the two functions by recycling the code from that example but with a simple substitution of 'trim' for 'chop':
<?php
$toomuchspace = " how are you ";
echo "<$toomuchspace>\n";
$thatsbetter = chop($toomuchspace);
echo "<$thatsbetter>";
?>
Prints this:
< how are you >
< how are you>
Mar 17, 2010