I didn't get the file, but
If the lines are seperated by 's instead of newlines, then
$filename = "monkey.html";
$file_array = preg_split("//", file_get_content($filename));
$rev_array = array_reverse($file_array);
$output = join("", $rev_array);
This could be modded to maintain any arguments in
At 07:05 PM 3/8/2006, Jabez wrote:
I used the following code that Paul suggested, but it didn't reverse my
content.
The file I would want to have the content reversed is as attached. Chinese
characters is in the file so...
Suggestions?
Jabez,
The data in your file is all in one text line.
rsday, March 09, 2006 2:58 AM
To: php-general@lists.php.net
Subject: Re: [PHP] .DAT file with PHP
At 10:27 AM 3/8/2006, Rory Browne wrote:
>$filename = "filename.txt";
>$file_content = join("\n", array_reverse(file($filename))); echo
>$file_content;
Rory,
I think you
last mail got accidently sent before completion - please reply to that, or
the OP and not this.
I don't have much of a problem with code that takes a less blatent
inspiration of the following:
$file = "filename.txt";
$file = file_get_contents($file);
$file = explode("\n", $file);
$file = array_re
On 3/8/06, Paul Novitski <[EMAIL PROTECTED]> wrote:
>
> At 10:27 AM 3/8/2006, Rory Browne wrote:
> >$filename = "filename.txt";
> >$file_content = join("\n", array_reverse(file($filename)));
> >echo $file_content;
>
>
> Rory,
>
> I think you've got the logic right.
>
> Tangentially, however, I reco
At 10:27 AM 3/8/2006, Rory Browne wrote:
$filename = "filename.txt";
$file_content = join("\n", array_reverse(file($filename)));
echo $file_content;
Rory,
I think you've got the logic right.
Tangentially, however, I recommend that you break it out into
separate statements and not throw mult
However, only "Array" text came out when I do an echo $read
What's wrong...?
Thanks for your patience!
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 08, 2006 11:50 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
php-general@lists.p
$filename = "filename.txt";
$file_content = join("\n", array_reverse(file($filename)));
echo $file_content;
Questions?
BTW I haven't tested this, so it may be completely wrong.
On 3/8/06, Paul Novitski <[EMAIL PROTECTED]> wrote:
>
> At 07:41 AM 3/8/2006, Jabez Gan wrote:
> >Sorry im new but
At 07:41 AM 3/8/2006, Jabez Gan wrote:
Sorry im new but, how do we read from a file to an array? I've studied C but
not with PHP and it's not working for me... Suggestions?
file()
Reads entire file into an array
http://php.net/file
Doesn't require open & close.
Paul
--
PHP General Mailing
[snip]
Sorry im new but, how do we read from a file to an array? I've studied C
but
not with PHP and it's not working for me... Suggestions?
[/snip]
First, read and understand, as much as possible, TFM. It should go
something like this
$foo = fopen("my.dat", "r");
while(!feof($foo)){
$bar
PROTECTED]; php-general@lists.php.net
Subject: RE: [PHP] .DAT file with PHP
[snip]
I want to use PHP to show the contents of the DAT from back to front.
HOw do
I do that?
[/snip]
Open the file, read it into an array, read the array backwards and close the
file. Start with http://www.php.net/fope
Jabez Gan wrote:
Sorry im new but, how do we read from a file to an array? I've studied C but
not with PHP and it's not working for me... Suggestions?
By line ?
--
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
hp-general@lists.php.net
Subject: RE: [PHP] .DAT file with PHP
[snip]
I want to use PHP to show the contents of the DAT from back to front.
HOw do
I do that?
[/snip]
Open the file, read it into an array, read the array backwards and close the
file. Start with http://www.php.net/fopen and http://www.php
[snip]
I want to use PHP to show the contents of the DAT from back to front.
HOw do
I do that?
[/snip]
Open the file, read it into an array, read the array backwards and close
the file. Start with http://www.php.net/fopen and
http://www.php.net/array they are both in the manual.
--
PHP Gen
I want to use PHP to show the contents of the DAT from back to front. HOw do
I do that?
Thanks!
hey guys
when you send me attachment,
It wont let me view the .dat file
what is that?
I tried to open with notepad and dreamweaver
but it wont view the code.
Karl
IncrediMail - Email has finally evolved - Click Here
16 matches
Mail list logo