Hi there !
$mystring = " ";
print "mystring = [" . $mystring . "]";
The output of the print function is : mystring = [ ]
Why does it show only one of the spaces ?
thx !
strings and whitespaces
Moderator: General Moderators
- RandomEngy
- Forum Contributor
- Posts: 173
- Joined: Wed Jun 26, 2002 3:24 pm
- Contact:
- protokol
- Forum Contributor
- Posts: 353
- Joined: Fri Jun 21, 2002 7:00 pm
- Location: Cleveland, OH
- Contact:
Re: strings and whitespaces
Use the code tags to display the code you are trying to use. It saves all your formatted text.Phraglord wrote:Hi there !
$mystring = " ";
print "mystring = [" . $mystring . "]";
The output of the print function is : mystring = [ ]
Why does it show only one of the spaces ?
thx !
If you are refering to why the HTML output only displays 1 of the spaces, this is because HTML formatting ingores whitespace. It will only display 1 space no matter how many you put in. If you want to keep the formatting either replace each space with or else enclose what you want displayed within a tag. If you use the <pre> tag though you will not be able to do HTML formatting on the text.
Hope that helps.
Code: Select all
<pre>output goes here</pre>Hope that helps.