# PHP code question...

**URL:** <https://boards.straightdope.com/t/php-code-question/562558>\
**Category:** Factual Questions\
**Created:** [December 1, 2010, 5:08pm UTC](https://boards.straightdope.com/t/php-code-question/562558 "2010-12-01T17:08:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaelghat](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@aaelghat](https://boards.straightdope.com/u/aaelghat)\
**Post date:** [December 1, 2010, 5:08pm UTC](https://boards.straightdope.com/t/php-code-question/562558/1 "2010-12-01T17:08:21Z")

</div>

Hi - I’m modifying someone else’s code, and I have a question…

A part of the code builds an array of all the files and folders in a particular directory on the server. Here is the line of code I want to change:

```auto

if (!eregi("tmp","$f") && !eregi("\.+","$f") ) { //skip tmp directory 

```

What I want to do, is in addition to the tmp directory getting skipped, I also want to skip an additional “Exclude” directory. How would I do that? Thanks.

---

<div class="post-metadata">

**Author:** ![UncleRojelio](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/unclerojelio/32/3160_2.png) [@UncleRojelio](https://boards.straightdope.com/u/UncleRojelio)\
**Post date:** [December 1, 2010, 5:13pm UTC](https://boards.straightdope.com/t/php-code-question/562558/2 "2010-12-01T17:13:02Z")

</div>

```auto

if (!eregi("tmp","$f") && !eregi("\.+","$f") && !eregi("Exclude", "$f")) { //skip tmp directory

```

---

<div class="post-metadata">

**Author:** ![aaelghat](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@aaelghat](https://boards.straightdope.com/u/aaelghat)\
**Post date:** [December 1, 2010, 5:22pm UTC](https://boards.straightdope.com/t/php-code-question/562558/3 "2010-12-01T17:22:35Z")

</div>

That worked like a charm… Thank you very much!!!

---

<div class="post-metadata">

**Author:** ![UncleRojelio](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/unclerojelio/32/3160_2.png) [@UncleRojelio](https://boards.straightdope.com/u/UncleRojelio)\
**Post date:** [December 2, 2010, 1:27am UTC](https://boards.straightdope.com/t/php-code-question/562558/4 "2010-12-02T01:27:32Z")

</div>

No problemo.
