hi all,

well sory for my bad question, its my bad. by the way thanks for your replied but it seems still have a problem. my only main goal is creat a function read a file. and I have this function to read the file. but I got an error message.

here is my error message.

Warning: file() expects parameter 1 to be string, array given in
Warning: Invalid argument supplied for foreach() in
Fatal error: Function name must be a string in.

and i have this code to read the file.

function processFile($filename) {
          $lines = file($filename);
             $returnArray= Array();
            foreach ($lines as $line) {
             return $returnArray();

and this my test page.

      $string = file('test.php');
         echo '<table>';
            foreach ($strings as $element => $value)
         echo '<p>'.$value.'</p>
         echo '</table>';

Have another Idea where did I got wrong, Im newbie in php??

9 Years
Discussion Span
Last Post by nav33n

$string = file('test.php');

file() returns an array. So, $string will be an array. You are supposed to send the filename!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.