mercredi 25 novembre 2015

Is_file and file_exists executes both clause in if statement

    function chbd($usrid)
{
    //wetlogs
    $wl = "php_err_log/wetlogs/";
    $usrid = '157632672';
    if(is_file($wl.$usrid.".txt"))
    {
              $e = file_get_contents($wl.$usrid.".txt");
              $d = fopen($wl.'test.txt', 'w+');
              fwrite($d, $e." if clause");

    }
    else
    {
        $e = fopen($wl.$usrid.".txt", 'w');
        fwrite($e, "1 else clause");
        return 'third';
    }
}

This piece of code executes both the if and else clauses, I cant seem to find out why. If anyone could shed some light

Aucun commentaire:

Enregistrer un commentaire