Beauford Posted June 5, 2009 Share Posted June 5, 2009 Can someone explain why the first example below works and the second doesn't. The second example doesn't remove the spaces. Thanks. echo $trimmed = trim($c['usr2']); echo"<td width='34%'>".$gangPREF."<a href='../viewuser.php?u={$c['uid2']}' {$csscode[$c['ul2']-1]}> ".trim($c['usr2'])."</a> [{$c['uid2']}] {$RM}</td> Link to comment https://forums.phpfreaks.com/topic/161014-can-someone-tell-me-why-this-doesnt-work/ Share on other sites More sharing options...
Ken2k7 Posted June 5, 2009 Share Posted June 5, 2009 Could it be that in your second case, there are a few spaces in the string between > and trim()? Link to comment https://forums.phpfreaks.com/topic/161014-can-someone-tell-me-why-this-doesnt-work/#findComment-849734 Share on other sites More sharing options...
Beauford Posted June 5, 2009 Author Share Posted June 5, 2009 Could it be that in your second case, there are a few spaces in the string between > and trim()? There is supposed to be, and it does display - just with all the spaces. It's not trimming them. Link to comment https://forums.phpfreaks.com/topic/161014-can-someone-tell-me-why-this-doesnt-work/#findComment-849766 Share on other sites More sharing options...
roopurt18 Posted June 5, 2009 Share Posted June 5, 2009 Why don't you make double sure that $c['usr2'] has what you expect it to have in it? echo "***<br/>" . htmlentities( $c['usr2'], ENT_QUOTES ) . "<br />***<br />"; echo "***<br/>" . htmlentities( trim( $c['usr2'] ), ENT_QUOTES ) . "<br />***<br />"; Link to comment https://forums.phpfreaks.com/topic/161014-can-someone-tell-me-why-this-doesnt-work/#findComment-849795 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.