getcwd

  • PHP’s getcwd function returns the path to the current working directory as a string.

    PHP

    $cwd = getcwd();
    var_export($cwd);
    //=> "/path/to/foo"

    Ruby’s Dir.pwd method is equivalent.

    Ruby

    cwd = Dir.pwd
    p cwd
    #=> "/path/to/foo"

    see also

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.