include / require runs constructor
Posted: Wed Apr 21, 2004 11:17 am
the include and require directives appear to cause the constructor of the specified file to run.
I expected to do this:
include 'myClass.php';
.
.
.
$myClass = new myClass();
but this actually causes 2 instantiations of myClass
to get what i want, i move the include statement to where the $myClass = new myClass statement is (and remove the $myClass statement)
its not like the C include, nor is it like a Java import.
no question, i guess, just seems odd to me.
comments welcome, though.
I expected to do this:
include 'myClass.php';
.
.
.
$myClass = new myClass();
but this actually causes 2 instantiations of myClass
to get what i want, i move the include statement to where the $myClass = new myClass statement is (and remove the $myClass statement)
its not like the C include, nor is it like a Java import.
no question, i guess, just seems odd to me.
comments welcome, though.