file_exists

  • PHP

    $exists = file_exists('/path/to/foobar');
    var_export($exists);
     
    //=> true

    Ruby

    exists = File.exist?('/path/to/foo/')
    p exists
     
    #=> true

    Note that in Ruby 1.8, File.exist? is also aliased to File.exists?. You should use File.exist? because this alias will be removed in future versions of Ruby.

    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.