Path · Mecha CMS

File/URL path helpers.

$path::D()

Author: Taufik Nurrohman · 194 Views

Tweet

Convert file path to its directory path.

Path::D($path, $step = 1, $s = null);

Example:

$test_1 = Path::D('foo\bar\baz.qux');
$test_2 = Path::D('foo\bar\baz.qux', 2);
$test_3 = Path::D('foo-bar-baz.qux', 1, '-');
$test_4 = Path::D('foo.bar.baz.qux', 1, '.');

Result:

$test_1 = 'foo\bar';
$test_2 = 'foo';
$test_3 = 'foo-bar';
$test_4 = 'foo.bar.baz';