11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

www.it-ebooks.infoCHAPTER 10 • WORKING WITH THE FILE AND OPERATING SYSTEM?>printf("Directory path: %s", dirname($path));This returns the following:Directory path: /home/www/dataLearning More about a PathThe pathinfo() function creates an associative array containing three components of a path, namely thedirectory name, the base name, and the extension. Its prototype follows:array pathinfo(string path [, options])Consider the following path:/home/www/htdocs/book/chapter10/index.htmlThe pathinfo() function can be used to parse this path into the following four components:• Directory name: /home/www/htdocs/book/chapter10• Base name: index.html• File extension: html• File name: indexYou can use pathinfo() like this to retrieve this information:This produces the following output:Dir name: /home/www/htdocs/book/chapter10Base name: index.htmlExtension: htmlFilename: indexThe optional $options parameter can be used to modify which of the four supported attributes arereturned. For instance, by setting it to PATHINFO_FILENAME, only the filename attribute will be populatedwithin the returned array. See the <strong>PHP</strong> documentation for a complete list of supported $options values.231

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!