Last active
September 24, 2016 10:27
-
-
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/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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