Location: PHPKode > scripts > Path > path/example.class.path.php
// First of all, we need to include the class
require_once "class.path.php";

// Then we'll create a new path, with all options
// In order, the options are : the path string, is the path pointing a
// directory, is there some string to put before the path, and what is the
// separator ?
$path = new Path("/some/path/to/test/", true, "http://", "/");

// Obviously, I want to output an URL, just look
echo "It's looking like an URL: $path\n";

// Now I create a new path with a completely different delimiter
$path2 = new Path("\a\file.php", false, null, "\\");

// And I can just append it to the previous one
// We could have done $path->b($path2), but it would have returned a new object
// with $path2 appened instead of changing $path

// And turn this into a SMB share
echo "Now it's a SMB share: $path\n";

// You can also use new basename() and dirname()
// Note that dirname() returns a Path and not a string
echo "The parent directory is: " . $path->dirname() . "\n";
echo "The pointed file is: " . $path->basename() . "\n";
echo "But without its extension it would be: " . $path->basename(".php") . "\n";
Return current item: Path