Tuesday, December 7, 2021

quick note to self: php mkdir has recursive mode

I was all set to make a half-assed (like, Unix slashes only, choking on filenames that had escaped slashes, etc) recursive directory maker (i.e. for /foo/bar/something , make foo if it doesn't exist, then foo/bar if that doesn't exist, etc) but realized it's built into PHP mkdir:

mkdir($finaldir,0755,true);

The final param is whether to do it recursively.

It's stuff like this that make me appreciate PHP a bit... like more so Perl or a lot of other languages / toolkits, thoughtful useful stuff is built in...

No comments:

Post a Comment