Skip to content

Instantly share code, notes, and snippets.

@kroatoanweb
Last active September 24, 2016 10:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kroatoanweb/6cdb4987afd8f17cf3b444689cbbacf5 to your computer and use it in GitHub Desktop.
Save kroatoanweb/6cdb4987afd8f17cf3b444689cbbacf5 to your computer and use it in GitHub Desktop.
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;
}
$firstLine = fgets($handle, 1024);
if ( ! $firstLine) {
fclose($handle);
return false;
}
//Do Something with firstline of file
fclose($handle);
return $firstLine;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment