This is the code I have so far, I wonder if it's correct?
$handle = fopen($file, 'w') or die("can't open file");
$closed = fclose($handle);
while($closed){
DOAWESOMETHINGS(); // btw I only want to have this run once for each handle
$closed = false;
}
Thank you so much!
You can check whether the handle has been closed or not using this statement
Therefore, if you need to ensure that fclose has worked before running the next function, you can use this loop:
Note: You should also use
break;
to end while loops when you need to. In this instance the loop will not end until the handle is closed.