I have a space in front of data in mysql database.I can't remove the space when I fetching it from data base.Please suggest me how to overcome it.str_replace,html_entity_decode is not working.Please suggest.when the output is coming we can see there is before data through page source.
$data = htmlentities($Events[0]->Time, ENT_QUOTES | ENT_IGNORE, "UTF-8"); echo str_replace(' ','',$data); using this I am able to remove extra character.
Use str_replace(' ','',$data); to resolve your problem. trim() function is cut space character at left and right of string. rtrim() function is only cut space character at right of string.
I am using ASP to read code from a text file that I am displaying on mypage. Because I do not want the code from the text file to be executed, Iused the Server.HTMLEncode() method to display it as it is in the file.However, the spaces used to indent lines is still removed by the browser.