Re: [PHP] please help me I try to post my question to Php.net 2-3 times

2006-02-16 Thread Kim Christensen
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   -
otherwise HTML truncates the excess whitespace. Try using REGEX:

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

This regular expression will replace all whitespace
(spaces/newlines/carriage returns) with the character  , 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



Re: [PHP] please help me I try to post my question to Php.net 2-3 times

2006-02-16 Thread Barry

Hugh Danaher wrote:

If you want to preserve the blank spaces then try;

str_replace(" ", " ", $contents); //   is html for blank space.
HTH
HTD


no he don't:
qote:

> read text file to array string


--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] please help me I try to post my question to Php.net 2-3 times

2006-02-16 Thread Hugh Danaher

If you want to preserve the blank spaces then try;

str_replace(" ", " ", $contents); //   is html for blank space.
HTH
HTD
- Original Message - 
From: <[EMAIL PROTECTED]>

To: 
Sent: Wednesday, February 15, 2006 10:26 PM
Subject: [PHP] please help me I try to post my question to Php.net 2-3 times



text file problem

read text file to array string. I use function File(). but when I display
data in text file it compress space in each lines such as first record
contain "1_2__3__4__" ( _ = blank )
when store in array string is "1 2 3 4" . I want you tell me howto do?
+

// data in text file is "1_2_3_4" < _ = blank>
// output is "1 2 3 4"
// I want fixed possition . please help me ?
from Wvolks

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



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.6/257 - Release Date: 2/10/2006






--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.6/257 - Release Date: 2/10/2006

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



[PHP] please help me I try to post my question to Php.net 2-3 times

2006-02-15 Thread wvolks
text file problem

read text file to array string. I use function File(). but when I display
data in text file it compress space in each lines such as first record
contain "1_2__3__4__" ( _ = blank )
when store in array string is "1 2 3 4" . I want you tell me howto do?
+

// data in text file is "1_2_3_4" < _ = blank>
// output is "1 2 3 4"
// I want fixed possition . please help me ?
from Wvolks

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