PHP 8.5.0 Alpha 1 available for testing

Voting

: max(two, zero)?
(Example: nine)

The Note You're Voting On

ian_channing at hotmail dot com
14 years ago
When trying to check a file path that could be windows or unix it took me quite a few tries to get the escape characters right.

The Unix directory separator must be escaped once and the windows directory separator must be escaped twice.

This will match path/to/file and path\to\file.exe

preg_match('/^[a-z0-9_.\/\\\]*$/i', $file_string);

<< Back to user notes page

To Top