fwrite($handle, "start".$string."end");
I have been trying to insert a great number of spaces in the $string statement using chr(32) and " " and ' '. But when I open the text file from my website with the fgets() function it doesn't show more than one space.
Does anyone have a thought?
fwrite() insetring spaces
Moderator: General Moderators
Re: fwrite() insetring spaces
Do you show it as an HTML or as a plain text?
There are 10 types of people in this world, those who understand binary and those who don't
- DigitalMind
- Forum Contributor
- Posts: 152
- Joined: Mon Sep 27, 2010 2:27 am
- Location: Ukraine, Kharkov
Re: fwrite() insetring spaces
Absolutely correct question. Use something like echo '<pre>' . $result . '</pre>' if you want to show all spaces.VladSun wrote:Do you show it as an HTML or as a plain text?
Re: fwrite() insetring spaces
I show it like HTML, ok now i will try the <pre></pre> tag, lets see.
Re: fwrite() insetring spaces
$html = "<pre> </pre>";
fwrite($handle, "start".$html."end");
It doesn't work fine. Instead of leaving my number of spaces it shows some new lines.
fwrite($handle, "start".$html."end");
It doesn't work fine. Instead of leaving my number of spaces it shows some new lines.
- DigitalMind
- Forum Contributor
- Posts: 152
- Joined: Mon Sep 27, 2010 2:27 am
- Location: Ukraine, Kharkov
Re: fwrite() insetring spaces
use pre tags while showing
Re: fwrite() insetring spaces
Hmm... I have understood to use it as the $string. Ok i will try.
Thanks you.
Thanks you.
- DigitalMind
- Forum Contributor
- Posts: 152
- Joined: Mon Sep 27, 2010 2:27 am
- Location: Ukraine, Kharkov
Re: fwrite() insetring spaces
Browsers always truncate spaces in HTML pages. If you write 100 spaces in your text, the browser will remove 99 of them, before displaying the page. To add spaces to your text, you can use the character entity or use: <pre>some text that will be shown as is</pre>