Question: I'm trying to delete cookie files with the `unlink()` function and it's not working properly

I tried this code (found on php.net)

```
<?php array_map('unlink', glob("some/dir/*.txt")); ?>

```

But it do not delete the last created file...

Answer: 
There are any number of reasons your code may be failing on one file but not the others. It doesn't appear to be a logic error, but the first thing I would do is try to rewrite this as a loop rather than using `array_map()`.

Then I would check for an error after each call to `unlink()` if it returns `FALSE`: `if (!(unlink($file)) print_r(error_get_last());` and see what the system tells you about what's going on.
I'm not %100 sure but maybe you have to include path:

```
<?php
    foreach(glob("some/dir/*.tmp") as $file)
    {
        unlink("some/dir/".$file);
    }

```