Path · Mecha CMS

File/URL path helpers.

$path::F()

Author: Taufik Nurrohman · 145 Views

Tweet

Convert file/folder path to a folder path.

Remove file/folder extension.

Path::F($path, $root = null, $s = DS);

Example:

$test_1 = Path::D('\a\b\c\foo\bar\baz.qux');
$test_2 = Path::D('\a\b\c\foo\bar\baz');
$test_3 = Path::F('\a\b\c\foo\bar\baz.qux');
$test_4 = Path::F('\a\b\c\foo\bar\baz');
$test_5 = Path::F('\a\b\c\foo\bar\baz.qux', '\a\b\c');
$test_6 = Path::F('\a\b\c\foo\bar\baz.qux', null, '/');

Result:

$test_1 = '\a\b\c\foo\bar';
$test_2 = '\a\b\c\foo\bar';
$test_3 = '\a\b\c\foo\bar\baz';
$test_4 = '\a\b\c\foo\bar\baz';
$test_5 = 'foo\bar\baz';
$test_6 = '/a/b/c/foo/bar/baz';