readlink

  • The readlink function in PHP returns the target of a symbolic link.

    PHP

    $target = readlink('/path/to/bar');
    var_export($target);
     
    //=> "/path/to/foo"

    Ruby’s File.readlink is equivalent.

    Ruby

    target = File.readlink('/path/to/bar')
    p target
     
    #=> "/path/to/foo"

    see also

readfile realpath

Looking for Rails or PHP web application development, integration, and training?

Rails for PHP is brought to you by Maintainable Software. Get custom web applications and personalized training from the authors of the book and website.