how to find the directory already is there or not in php

Posted by zahir hussain on Stack Overflow See other posts from Stack Overflow or by zahir hussain
Published on 2010-05-25T12:32:52Z Indexed on 2010/05/25 12:41 UTC
Read the original article Hit count: 342

Filed under:
|
|

hi

i want know find the directory is already there or not...

if not i would like to create the directory...

my coding is below...

    $da = getdate();

$dat = $da["year"]."-".$da["mon"]."-".$da["mday"];

$m = md5($url)."xml";

if(is_dir($dat)) { chdir($dat);

$fh = fopen($m, 'w');

fwrite($fh, $xml);

fclose($fh);

echo "yes"; } else { mkdir($dat,0777,true);

chdir($dat);

$fh = fopen($m, 'w');

fwrite($fh, $xml);

fclose($fh);

echo "not"; }

thanks and advance

© Stack Overflow or respective owner

Related posts about php

Related posts about mkdir