Can't seem to remove extra whitespace in php or javascript -
hey guys =) i'm having small problem. have php code gets string stored in database favoritegamelist, , in database, doesn't appear have white space. when try echo string out generates bunch of new line characters. used javascript character code of characters creating space , 10 , that's new line? either way, figured preg_replace function work, or maybe trim? tried trim, no avail. have code:
$gamelist = preg_replace('/[\x00-\x1f\x80-\x9f]/u', '', $row['favoritegamelist']); echo $gamelist;
after code executes, javascript runs , collects echo, log console , see ton of white space , i'm stuck trying rid of it. javascript code here:
var mygames = document.getelementbyid("favoritegamesdiv").innerhtml; console.log(mygames);
favoritegamesdiv area echo statement in php applicable. , console log is:
llamas in distress,bow master halloween,squary,
with space... i'm not sure do. appreciated ^-^ bearing me
try using you..
$gamelist = preg_replace('/\s+/', ' ',$row['favoritegamelist']));
Comments
Post a Comment