while(!feof($fp)) { //if fp not a resource then the while will no end forever
echofgets($fp);
}
1
<?php$fp=fopen("file.txt","r");if(!$fp)exit;while(!feof($fp)){//if fp not a resource then the while will no end forever echo fgets($fp); }