madspof Posted August 30, 2007 Share Posted August 30, 2007 i have writting this bit of code but it does'nt seem to work correctly could some one give me some hints on what is going wrong madspof thnks $dir = "/madspof"; if (is_dir('$dir')) { echo "Found that directory <BR>"; }{ echo "Did not find that directory <BR>"; } echo "$dir"; Quote Link to comment https://forums.phpfreaks.com/topic/67268-solved-is-this-the-right-way-of-going-about-it/ Share on other sites More sharing options...
Crew-Portal Posted August 30, 2007 Share Posted August 30, 2007 Try using: <?php $dir = "madspof/"; if (is_dir('$dir')){ echo "Found that directory!"; } else { echo "Did not find the directory" . $dir . ""; } ?> Exact same for is_file() command Quote Link to comment https://forums.phpfreaks.com/topic/67268-solved-is-this-the-right-way-of-going-about-it/#findComment-337453 Share on other sites More sharing options...
Crew-Portal Posted August 30, 2007 Share Posted August 30, 2007 sorry after I posted I saw some things in the code that I did not add! <?php $dir = "madspof/"; if (is_dir('$dir')){ echo "Found that directory!"; } else { echo "Did not find the directory" . $dir . ""; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/67268-solved-is-this-the-right-way-of-going-about-it/#findComment-337457 Share on other sites More sharing options...
madspof Posted August 30, 2007 Author Share Posted August 30, 2007 I could n ot get it to work am gona go googling but if you come up with anything please tell me thnks Quote Link to comment https://forums.phpfreaks.com/topic/67268-solved-is-this-the-right-way-of-going-about-it/#findComment-337458 Share on other sites More sharing options...
trq Posted August 30, 2007 Share Posted August 30, 2007 Variables are not interpolated within single quotes. <?php $dir = "/madspof"; if (is_dir($dir)) { echo "Found that directory <BR>"; } else { echo "Did not find that directory <BR>"; } echo $dir; ?> Quote Link to comment https://forums.phpfreaks.com/topic/67268-solved-is-this-the-right-way-of-going-about-it/#findComment-337460 Share on other sites More sharing options...
madspof Posted August 30, 2007 Author Share Posted August 30, 2007 very good point how did i miss that lol any way thanks a lot Quote Link to comment https://forums.phpfreaks.com/topic/67268-solved-is-this-the-right-way-of-going-about-it/#findComment-337462 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.