Skip Navagation

Full On Design

A Web Development & Technology Blog

 

PHP Function: realpath()

Rogem

About the Author

Mike Rogers is a Web Developer who is currently at University studying Web Technologies. He also is the founder of Full On Design. He has several years experience freelancing and you can follow him on Twitter (Rogem002).

One functions I wish I had known about when i start learned PHP is the realpath() function. Pretty much what it does is take symbolic link (such as ‘../’ or ‘/’) and returns a canonicalized absolute link (like ‘/home/public_html/folder’). Here is an example of it in action:

<?php
echo realpath('../');
// Would return: /home/mike/www/blogposts
?>