Skip to content

Instantly share code, notes, and snippets.

@kroatoanweb
Last active September 24, 2016 10:27
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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