3
When we open a file with fopen
, we use the function fclose
to close the file handler.
$handle = fopen('file.txt', 'r');
fclose($handle);
But my curiosity is: And when we use the object SplFileObject
? He doesn’t have the method fclose
.
How the file is closed when we instantiate this class to open it?
$file = new SplFileObject('file.txt', 'r');
$file-> // Como faço para fechar?
+1 interesting, so it works the same way as in PDO. Cool
– Wallace Maxters