Results 1 to 3 of 3

Thread: need PERL to PHP help

  1. #1
    I'm a farmhand on your dad's rooster ranch. haganxy's Avatar
    Join Date
    Dec 2004
    Location
    Seattle, WA
    Posts
    379

    need PERL to PHP help

    OK, in PERL, i can check a file to see if it exists, by doing this:

    Code:
    if (-e "somefile.txt") {  ... }

    which means "if this file exists, then do whatever block of code"...

    how do i do the equivalent in PHP? i've looked and looked but couldn't find the answer.
    hagan - IT nerd
    PrideBucks.com
    ICQ: 49962103


  2. #2
    Life is a dick and when itīs get hard---just fuck it... DEVELISH's Avatar
    Join Date
    Jul 2005
    Posts
    2,367
    Hi Hagan


    http://php.net/file-exists

    PHP Code:
    <?php
    $filename 
    '/path/to/foo.txt';

    if (
    file_exists($filename)) {
       print 
    "The file $filename exists";
    } else {
       print 
    "The file $filename does not exist";
    }
    ?>

    hope that helps

    :develish:


  3. #3
    I'm a farmhand on your dad's rooster ranch. haganxy's Avatar
    Join Date
    Dec 2004
    Location
    Seattle, WA
    Posts
    379
    that worked perfectly! thank you!!!
    hagan - IT nerd
    PrideBucks.com
    ICQ: 49962103


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •