If I'm in a Class' static function, can I create a new object of that same Class using some sort of $this-> or self:: notation, instead of using the actual class name? So that I can rename the class without having to go through my static functions and changing the class name in there too?
Like, let's say I'm in a static function called Comment::getCommentCount(). If I want to access another static function, I can use
instead of
. I'd like to be able to create a new object a similar way, like, for example
instead of
(in PHP)
Thanks!
Edit: Wait a minute, did I just answer my own question? Using new self(); is working now. Is that the proper way of doing it?
Like, let's say I'm in a static function called Comment::getCommentCount(). If I want to access another static function, I can use
Code:
self::anotherStatic();
Code:
Comment::anotherStatic();
Code:
$obj = new self();
Code:
$obj = new Comment();
(in PHP)
Thanks!
Edit: Wait a minute, did I just answer my own question? Using new self(); is working now. Is that the proper way of doing it?