(PHP ActiveX) Demonstrate Directory Path Functions
Demonstrates the path functions GetDirectoryName, GetExtension, GetFileName, and GetFileNameWithoutExtension.
<?php
// For versions of Chilkat < 10.0.0, use new COM('Chilkat_9_5_0.Chilkat.FileAccess')
$fac = new COM("Chilkat.FileAccess");
// Note: Chilkat accepts either forward slash or backslash chars as directory separators..
print $fac->getDirectoryName('/MyDir/MySubDir/myfile.ext') . "\n";
print $fac->getDirectoryName('/MyDir/MySubDir') . "\n";
print $fac->getDirectoryName('/MyDir/') . "\n";
print $fac->getDirectoryName('/MyDir') . "\n";
print $fac->getDirectoryName('/') . "\n";
print $fac->getExtension('C:/mydir.old/myfile.ext') . "\n";
print $fac->getExtension('C:/mydir.old/') . "\n";
print $fac->getFileName('C:/mydir/myfile.ext') . "\n";
print $fac->getFileName('C:/mydir/') . "\n";
print $fac->getFileNameWithoutExtension('C:/mydir/myfile.ext') . "\n";
print $fac->getFileNameWithoutExtension('C:/mydir/') . "\n";
print '---' . "\n";
?>
|