When we open a file with fopen
, we use the function fclose
to close the handle of that file.
$handle = fopen('file.txt', 'r');
fclose($handle);
But my curiosity is: And when we use the object SplFileObject
? It does not have the fclose
method.
How does the file close when we instantiate this class to open it?
$file = new SplFileObject('file.txt', 'r');
$file-> // Como faço para fechar?