Massacres Posted November 22, 2006 Share Posted November 22, 2006 Using my knowledge of C/C++ (which is basic) I came up with this, I don't know a way to deal with the whole "We don't want whitespace so we WILL NOT LET YOU HAVE white space", 'thing'. I think it was for bandwidth, some programmers wouldn't get rid of whitespace and it would send useless bits; I want those 'useless' bits. (Sorry my history is a little sketchy).[code]<?phpfor ($i=1; $i<101;$i++){ echo $i," "; if ($i % 5 === 0) { echo "<br>"; } else{ if ($i<10){ echo " "; } } }?>[/code]Basically I WANT the whitespace so I can make everything even; without tables. Link to comment https://forums.phpfreaks.com/topic/28057-dealing-with-whitespace/ Share on other sites More sharing options...
jawapro Posted November 22, 2006 Share Posted November 22, 2006 Try using [code]" "[/code] instead of [code]" "[/code]That is the HTML code to force a space. Link to comment https://forums.phpfreaks.com/topic/28057-dealing-with-whitespace/#findComment-128354 Share on other sites More sharing options...
Massacres Posted November 22, 2006 Author Share Posted November 22, 2006 EDIT: it didn't work; see the bottem.Ideal situation; the underscores removed and replaced with spaces.[code]<?phpfor ($i=1; $i<101;$i++){ if ($i<10){ echo "_"; } echo "_",$i; if ($i % 5 === 0) { echo "<br>"; } else{ echo "_"; } }?>[/code]Code that didn't work T_T[code]<?phpfor ($i=1; $i<101;$i++){ if ($i<10){ echo " "; } echo " ",$i; if ($i % 5 === 0) { echo "<br>"; } else{ echo " "; } }?>[/code]EDIT It works now haha, wow I'm blind sorry.[code]<?phpfor ($i=1; $i<101;$i++){ if ($i<10){ echo " "," "; } echo $i; if ($i % 5 === 0) { echo "<br>"; } else{ echo " "; } }?>[/code] Link to comment https://forums.phpfreaks.com/topic/28057-dealing-with-whitespace/#findComment-128355 Share on other sites More sharing options...
kenrbnsn Posted November 22, 2006 Share Posted November 22, 2006 You will find that if you are trying to align the output using spaces things will usually not align well unless you are using a fixed width font. You're best bet is to learn how to use CSS to define your layout.Ken Link to comment https://forums.phpfreaks.com/topic/28057-dealing-with-whitespace/#findComment-128380 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.