Class Efficentcy
Posted: Sat Jan 12, 2008 8:50 pm
[I'm writing a class and I was wondering if it was:
better to define the specific class that the variable will be like this
making sure the correct space is set aside because it will be needed later anyways. And say something is going to be an array and it is define as such:
is there a way for me to set it so that it knows that the friends array is of type user?
or if i should i just define it as:
better to define the specific class that the variable will be like this
Code: Select all
$this->author = new user();Code: Select all
$this->friends = array();or if i should i just define it as:
Code: Select all
$this->author = null;
$this->friends = null;