Reputation: 11642
Hello i would like to ask: How to call static function from constructor in same class PHP?
I have got:
public function __construct()
And I need to call this function
private function _regenerateThumbnails($type = 'all', $deleteOldImages = false)
in constructor.
Is it possible in PHP and if yes, how?
Thanks for any advice.
Upvotes: 1
Views: 3388
Reputation: 723729
First of all, you should explicitly declare that method static, like this:
private static function _regenerateThumbnails($type = 'all', $deleteOldImages = false)
To call it in your constructor, use the self
keyword:
public function __construct() {
// Pass arguments from your constructor to your method
// where appropriate
self::_regenerateThumbnails();
}
Upvotes: 11