Page 1 of 1

Outputting a file into an array

Posted: Tue May 12, 2009 4:08 pm
by misfitxnet
I am trying to output a text file, that contains form information from a comment form.
I am using this php script

Code: Select all

 
<?php
                $delimiter="\t";
                $commenttext=file("d:\hshome\c239198\local54memberforum.com\info.txt");
               list($namedisp,$commentdisp)=explode($delimiter,$commenttext);
                echo $namedisp;
                echo $commentdisp;
 
                ?>
 
When i run the script, I get "Array" returned in the browser.
does anyone know why it will not return $namedisp, and $commentdisp? Here is a test sample of info.txt:

"hey hey hey hey "

Re: Outputting a file into an array

Posted: Tue May 12, 2009 4:27 pm
by requinix
array file ( string $filename [, int $flags= 0 [, resource $context ]] )

Reads an entire file into an array.
On the other hand, file_get_contents returns a string...