help on garbage collection function
| From: | Charles Killian | Date: | Thu, 31 Aug 2000 20:24:04 +0000 |
| Subject: | help on garbage collection function | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-14676@lists.php.net to get a copy of this message | ||
The garbage collection function below returns true a percentage of the time
depending what number you pass it.
Is there is a more efficient way to perform this task?
/* pass a number from 1 to 100: percentage of time this function returns
true. */
function collect_garbage($percent){
mt_srand((double) microtime() * 1000000);
if(in_array(mt_rand(1,100), range(1,$percent)))
return TRUE;
else
return FALSE;
}
Charles