Search code examples
phprandommkdir

PHP puts random numbers in directory names. Why?


I'm trying to create a directory in PHP using mkdir () . It works but PHP puts random numbers in the end of the name:

mkdir (testdir);

creates a directory testdir511. Is there any way to fix this ?


Solution

  • You've probably used . (the concatenation thingy) instead of a comma when separating your arguments:

    $ php
    <?php
    mkdir("test" . 655); // should be mkdir("test", 655);
    ?>
    $ ls
    test655/