PHP 8.5.0 Alpha 4 available for testing

Voting

: min(nine, one)?
(Example: nine)

The Note You're Voting On

flobee
10 years ago
In this doc page i see things for to hide hidden files (also for opendir() or readdir() .... this should be mentiond all there
<?php
// not hidden but on most OS systems Win, *nix, OSX..
if ($file == '.' || $file == '..') {
// "." current dir info,
// ".." dir above info,
continue;
?>
or
<?php
if $name[0] === '.' // NOT OK FOLKS
?>
Think:
"... and then came Polly.avi" is the title of the Movi. What do you do then?

Windows does it different with hidden files than unix based systems.

For unix based systems something like this should work:
<?php
if (preg_match('/^(\.\w+|\.$|\.\.$)/i', $location)) {
/* is hidden:
.
..
.dir
.file
*/
}
// must be ok: "..some thing", "... some thing"
?>

I know you do it (if $name[0] === '.' ) because it is much faster. But it is NOT correct and some day you miss things like me today :-)

<< Back to user notes page

To Top