Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define('ARRAY_CACHE_FILE', dirname(__FILE__) . '/array-cache.txt');
- function get_array(){
- if( time() - filemtime(ARRAY_CACHE_FILE) < 3600 ){
- return unserialize( file_get_contents(ARRAY_CACHE_FILE) );
- }
- $array = generate_array(); // ...
- file_put_contents( ARRAY_CACHE_FILE, serialize(array) );
- return $array;
- }
Add Comment
Please, Sign In to add comment