On 2/16/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> $filename =3D "c:data.txt";
> $contents =3D file($filename);
> echo $contents;
> ?>
> // data in text file is "1_____2_____3_____4" < _ =3D blank>
> // output is "1 2 3 4"
> // I want fixed possition . please help me ?

I'm not really sure what you're trying to do, but I assume you want to
keep the four(?) spaces when you output the data. If you're going to
display it using HTML, you have to replace the spaces with &nbsp; -
otherwise HTML truncates the excess whitespace. Try using REGEX:

$contents =3D file($filename);
echo preg_replace("/\s/", "&nbsp;", $contents);

This regular expression will replace all whitespace
(spaces/newlines/carriage returns) with the character &nbsp;, which in
HTML yields a blank space.

--
Kim Christensen
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to