# Is Empty functionality to the Directory Functions

- Thread: https://externals.io/message/42304
- Original archive: https://news-web.php.net/php.internals/42304
- Started by olafurw@gmail.com on 2008-12-17T19:01:17+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #42304 — olafurw@gmail.com — 2008-12-17T19:01:17+00:00

URL: https://externals.io/message/42304#42304

This is my 1st suggestion to the internals :)

Anywho, there has been some discussion in the `is_dir()` comments on
php.net (http://is.php.net/manual/en/function.is-dir.php) about a
function that returns bool if a directory is empty or not.

Just throwing it out there if it should be implemented to the current
list of Directory Functions.

$dir = dir("/foo/bar");
var_dump($dir->empty()); // bool(true)

Ólafur Waage
olafurw@gmail.com

---

## #42312 — crrodriguez@suse.de — 2008-12-17T22:48:29+00:00

URL: https://externals.io/message/42304#42312 · In reply to: #42304

Ólafur Waage escribió:

> $dir = dir("/foo/bar");
> var_dump($dir->empty()); // bool(true)

Use SplDirectoryIterator instead.


-- 
"We have art in order not to die of the truth" - Friedrich Nietzsche

Cristian Rodríguez R.
Platform/OpenSUSE - Core Services
SUSE LINUX Products GmbH
Research & Development
http://www.opensuse.org/

---

## #42318 — olafurw@gmail.com — 2008-12-18T01:11:27+00:00

URL: https://externals.io/message/42304#42318 · In reply to: #42312

Yes the SPL directory listing has more functionality but not the one i
am talking about. It's not something crucial but useful while
iterating through directories.

Oh and I should to sit down over the holidays and write examples for
the SPL Directory functions and send over to the documentation team.

Ólafur Waage
olafurw@gmail.com

On Wed, Dec 17, 2008 at 10:48 PM, Cristian Rodríguez
<crrodriguez@suse.de> wrote:
> Ólafur Waage escribió:
>
> > […]
>
> Use SplDirectoryIterator instead.
>
>
> --
> "We have art in order not to die of the truth" - Friedrich Nietzsche
>
> Cristian Rodríguez R.
> Platform/OpenSUSE - Core Services
> SUSE LINUX Products GmbH
> Research & Development
> http://www.opensuse.org/

---

## #42319 — Philip Olson — 2008-12-18T01:16:46+00:00

URL: https://externals.io/message/42304#42319 · In reply to: #42318

> Oh and I should to sit down over the holidays and write examples for
> the SPL Directory functions and send over to the documentation team.

The email address for that task is phpdoc@lists.php.net :)

Regards,
Philip
