Jump to content

Check if a list of directories exist from Array()


acid.waste

Recommended Posts

$arr = array('../', 'j/', 'AcidBB/', 'fileBOMB/', 'OurHome', 'up');
foreach ($arr as $value) {
    // echo "Value: $value<br /><br />";
if (is_dir($value)) {
	echo "<tr> <td>{$value}</td> <td><font color='#66FF33'>Exists</font></td></tr><br />";
} else {
	echo "<tr> <td>{$value}</td> <td><font color='#FF0000'>Does Not Exist</font></td></tr><br />";
}
}

~~~ Solved after posting. Sorry. ~~~

Ok i have an Array of directories i need to check before the script installs itself, I know how to check for directories but i dont know how to scan each array in the list without calling each one seperately in

If() { } Else If { } Else If { }

And so on and so on... My Question is, If a For Statement is neaded, How would i go about checking each string in the Array List?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.