PHP - File System

> Procedural Languages > Php

1 - About

2 - Snippets

2.1 - Create directory

if (!file_exists($dir)) {
        mkdir($dir, $mode = 0777, $recursive = true);
}

where:

Advertising

2.2 - Get the file extension

$path_parts = pathinfo('/www/htdocs/inc/lib.inc.php');
 
echo $path_parts['dirname'], "\n";
echo $path_parts['basename'], "\n";
echo $path_parts['extension'], "\n";
echo $path_parts['filename'], "\n"; // since PHP 5.2.0
lang/php/fs.txt · Last modified: 2019/02/15 18:52 by gerardnico