Jump to content

function not working.


chaosxkitten

Recommended Posts

 

This is the function I wrote

 

function getParagraph($myfile) {

  while (!feof($myfile)){

    $data = fgets($myfile);

    $paragraph = explode("\n", $data);

}

  return $paragraph;

}

 

 

When I print the array, it's empty.

 

while ($paragraph = getParagraph($file)){

  print_r($paragraph);

}

 

Prints to my webpage as:

Array ( [0] => )

 

 

The file is NOT empty, and it is formated by line breaks so I don't know what's not working.

 

Link to comment
https://forums.phpfreaks.com/topic/226801-function-not-working/
Share on other sites

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.