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:

 

           

         

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.