note 106625 modified in function.tmpfile by danbrown

From: Date: Wed, 30 Nov 2011 21:07:14 +0000
Subject: note 106625 modified in function.tmpfile by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-184829@lists.php.net to get a copy of this message
A clean method to use temporary file: <?php $tmp=array_search('uri', @array_flip(stream_get_meta_data($GLOBALS[mt_rand()]=tmpfile()))); file_put_contents($tmp, 'hello'); echo file_get_contents($tmp); ?> without need to fclose the tmp file, it will be deleted while the php ends. --was-- A clean method to use temporary file: <? $tmp=array_search('uri', @array_flip(stream_get_meta_data($GLOBALS[mt_rand()]=tmpfile()))); file_put_contents($tmp, 'hello'); echo file_get_contents($tmp); ?> without need to fclose the tmp file, it will be deleted while the php ends. http://php.net/manual/en/function.tmpfile.php

« previous php.notes (#184829) next »