Jump to content

what is wrong wiht my fucntion?? pls need help


gudfry

Recommended Posts

hi all;

 

            I 'am newbie in PHP and I 'am getting hard to understand some of PHP stuff, but Pls help with my problem, I' am workin gon two files. I ahve function to read the test page. when I run my code I got a error message, I dont know where I got wrong.

 

            here is my function to read the file.

function processFile($filename) {
                   $lines = file($filename);
                   $returnArray= array();
                   foreach ($lines as $line) {
                          $output=processFile($line);
                      if (gettype($output)=="array") {
                         $returnArray[]='<tr><td>Title:</td><td>'.($output[0]).'</td><td>Value:</td><td>'.$output[1].'</td></tr>';
                      }      
                   }
                   return $returnArray;
                }

 

          here is my test page to test my function if its working.

 

         

require_once('chadlib.php');
              $strings=processFile("test.php");
                   echo '<table>';
                     foreach ($strings as $element => $value)
		$output=processFile($strings);
                        echo $value;
                        echo '</table>';

 

            and my  problem is I got this error.

           

             Notice: Undefined offset: 0 in F:\Program Files

             Warning: file(<title>test</title> ) [function.file]: failed to open stream: Invalid argument in F:

             Warning: file() expects parameter 1 to be string, array given in F:

 

           

         

hi tibberous;

 

              im sory about my function, its my bad, well the main goal of my assignment is to read the whole page of the file input in my test page. but i gave those error. its recursive because im returning the value array of string. can you help me with this.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.