Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Usar finally para ejecutar código de forma diferida: http://www.kroatoan.es/articulos/ejecucion-diferida-php-usando-finally/
<?php
$handle = fopen($location, 'r+');
if ($handle === false) {
return false;
}
try {
$firstLine = fgets($handle, 1024);
if ( ! $firstLine) {
return false;
}
//Do Something with firstline of file
} finally {
fclose($handle);
}
return $firstLine;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.