note 61436 added to function.tempnam

From: Date: Fri, 03 Feb 2006 08:32:51 +0000
Subject: note 61436 added to function.tempnam
Groups: php.notes 
Request: Send a blank email to php-notes+get-102920@lists.php.net to get a copy of this message
This function creates a temporary directory. The previous example given could bug if between the unlink() and mkdir() some process creates the same directory or file. This implementation is faster too. <?php function tempdir($dir, $prefix='', $mode=0700) { if (substr($dir, -1) != '/') $dir .= '/'; do { $path = $dir.$prefix.mt_rand(0, 9999999); } while (!mkdir($path, $mode)); return $path; } ?> ---- Server IP: 194.109.193.119 Probable Submitter: 195.225.34.5 ---- Manual Page -- http://www.php.net/manual/en/function.tempnam.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61436 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61436&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61436&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61436&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61436&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61436&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61436&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61436&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61436&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#102920) next »