I'm having a small problem. I have some php code which gets a string stored in a database as favoritegamelist, and in the database, it doesn't appear to have any extra white space. However when I try to echo the string out it generates a bunch of new line characters. I used javascript to get the character code of the characters creating space and it was 10 and that's new line?
Either way, I figured a preg_replace function would work, or maybe trim? So I tried trim, to no avail. Currently I have this code:
$gamelist = preg_replace('/[\x00-\x1F\x80-\x9F]/u', '', $row['favoritegamelist']);
echo $gamelist;
After this code executes, some javascript runs and collects the echo, then I log it to the console and this is where I see a ton of extra white space and I'm just stuck trying to get rid of it. The javascript code is here:
var mygames = document.getElementById("favoriteGamesDiv").innerHTML;
console.log(mygames);
favoriteGamesDiv is the area that the echo statement in php is applicable. And finally the console log that I get is:
Llamas in Distress,Bow Master Halloween,Squary,
With all that extra space... So I'm not sure what to do. Any help would be appreciated ^-^ Thanks for bearing with me
trim... ExamplefavoriteGamesDivprobably has some format newlines/padding. So if you get the innerHTML, you will get all the whitespace as well.favoriteGamesDivis that atextareaorinput