Page 2 of 2

Posted: Mon Jun 04, 2007 3:51 pm
by RobertGonzalez
Try looking at this recursive directory scanner feyd coded once. That might help you wrap your mind around what you are doing. The next step is learning how to instantiate an object. When you place a parameter in the constructor of the class, and you call the class without the parameter, you are going to have trouble.

Also, you may want to make sure you are developing with error_reporting set to E_ALL and display_errors on.

Posted: Mon Jun 04, 2007 6:04 pm
by feyd
Ahem. I didn't do recursion in those snippets; Scottayy did.

;)

Posted: Mon Jun 04, 2007 6:14 pm
by RobertGonzalez
Sorry. Forgot about that.

Posted: Tue Jun 05, 2007 3:43 am
by volka
cesarcesar wrote:Mr The Moose, thanks but is still no progress.
Anyway, $class = new DirTree(); won't work. You have to pass a parameter here.

take a look at

Code: Select all

<?php
class FooA {
	function FooA() {
		echo ' FooA ';
	}
}

class FooB {
	function FooB($x) {
		echo " FooB($x) ";
	}
}

class FooC {
	function FooC($x, $y) {
		echo " FooC($x, $y) ";
	}
}


$a = new FooA;  // ok, the FooA's constructor doesn't need a parameter

// $b = new FooB; // warning, FooB's constructor needs one parameter
$b = new FooB(1);

// $c = new FooC; // warning, FooB's constructor needs two parameters
// $c = new FooC(1); // warning, FooB's constructor needs two parameters
$c = new FooC(1,2);