hello, i was wondering if someone can explain me what the difference is between the following classes.
I found class B nicer to use, but i want to have your comments.....
class A
{
public function setField($var)
{
$this->anyfield = $var;
}
}
//this is how i use it
$A = new A();
$A->setField($_POST['values']);
class B
{
public static function setField($var)
{
self::$anyfield = $var;
}
}
//this is how i use it
B::setField($_POST['values']);
Question:
- What does "static" means when declaring a function?
- Is "$this->" equal to "self: : $ " ? is there any difference?
The reason i am asking the questions is because i am about to re-code a big application I developed with PHP 4; and i want to do it right. I am also using PDO and trying to use/learn MVC.
Thank you all in advance.