Women in Technology

Hear us Roar

  Working with Files in PHP, Part 3
Subject:   dir class
Date:   2003-02-06 12:31:15
From:   arjo.post@hccnet.nl
the following object creation is not working for me:
$mydir = new dir('/path/to/mydir');
I get the error:
Fatal error:
Cannot instantiate non-existent class: dir in d:\myphp\dir.php on line 2
can you help me?


Main Topics Oldest First

Showing messages 1 through 3 of 3.

  • dir class
    2004-11-05 18:22:58  Tyrrael [View]

    Its kind of simple, my guess its that it depends on PHP version, por PHP 4 just remove the creation of the class thats NEW
    $mydir = new dir('/path/to/mydir');

    $mydir = dir('/path/to/mydir');
  • dir class
    2003-11-19 12:28:21  anonymous2 [View]

    BTW, the if(is_dir($mydir->path.$file)) part includes the .. and . "directories"... so if, like me, you just wish to display a list of sub-directories, you'll need to ignore those two entries:

    if(is_dir($mydir->path.$file) && !strstr($file,".")) {

    Great article BTW :-)
  • dir class
    2003-02-12 10:48:17  chromatic | O'Reilly AuthorO'Reilly Blogger [View]

    It was a typo; it has since been fixed. (There is no need for the "new" keyword.)