PHP code example of phlib / path
1. Go to this page and download the library: Download phlib/path 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/ */
phlib / path example snippets
php
$path = \Phlib\Path::fromString('foo/bar/baz');
$info = $path->info(); // should return the same as `pathinfo`
php
$path = \Phlib\Path::fromString('foo/bar\\/baz');
echo $path->info(\Phlib\Path::INFO_BASENAME); // bar\/baz
php
$parts = ['foo', 'bar/baz', 'taz'];
$path = new \Phlib\Path($parts);
echo $path->toString(); // foo/bar\/baz/taz