i'm doing some pondering about saving variables then calling them again through creating simple text files then calling them..... the problem with that is, how would i get to save a file with a name that is NOT user specified?
Just generate a random number and make that the filename. If you want to get fancier, make it an md5 hash using the md5() function. Fancier still, if you want to make it less than 32 characters, use substr().
http://www.php.net/manual/en/function.rand.php http://www.php.net/manual/en/function.md5.php http://www.php.net/manual/en/function.substr.php
<? function getTimeBasedName(){ list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec) * 100; } $name = getTimeBasedName().".dat"; print $name; ?>
ok... how does that code work that you just posted? i think it's great that you're willing to help me but it's nicer if i know what i'm doing 🙂
😕 getTimeBasedName() is a function which builds a microtime based string, that's all.
Try it, I'm sure you will understand it
ok well what are list and explode?
http://www.php.net/uniqid
http://www.php.net/manual/en/function.microtime.php http://www.php.net/manual/en/function.list.php
Microtime returns "msec sec" separated by a space.
list($usec, $sec) = explode(" ",microtime());
Basically sets two variables. $usec is the value that microtime() returns before the space, $sec is the value after the space.