| Here in below code we have used keyword chop it is used to remove space from end of string. One more thing is that it will remove trailing not leading space to remove leading space we need trim.
< ?php
$contents = " getproductprice.com ";
echo "<$contents>\n";
echo "<" . chop($contents) . ">";
< getproductprice.com >
< getproductprice.com>
? > | | |