gudfry Posted July 24, 2008 Share Posted July 24, 2008 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: Quote Link to comment Share on other sites More sharing options...
tibberous Posted July 24, 2008 Share Posted July 24, 2008 Why is it recursive? Thats a crazy looking function... Quote Link to comment Share on other sites More sharing options...
gudfry Posted July 24, 2008 Author Share Posted July 24, 2008 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.