PHP code example of timostamm / pathinfo

1. Go to this page and download the library: Download timostamm/pathinfo library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

timostamm / pathinfo example snippets



$root = Path::info('/var/wwwroot/index.html');

$root->equals('/foo/../var/root/index.html'); // -> true
$root->isIn('/var/wwwroot/'); // -> true
$root->isAbsolute(); // -> true

$root->dirname(); // -> "/var/wwwroot/"
$root->filename(); // -> "index.html"
$root->basename(); // -> "index"
$root->extension(); // -> "html"

Path::info('../log.txt')
	->abs($root)
	->get(); // -> "/var/log.txt"

Path::info('/foo/../var/root/index.html')
	->normalize()
	->get(); // -> "/var/wwwroot/index.html"