PHP: Difference between revisions

From Wiki RB4
Line 12: Line 12:
* ctor
* ctor
  function __construct() {
  function __construct() {
   parent::__construct() // has to be called explicitly
   parent::__construct(); // has to be called explicitly
   ...
   ...
}
* dtor
function __destruct() {
  parent::__destruct(); // has to be called explicitly
  }
  }

Revision as of 09:52, 16 August 2018

OO

  • namespace?
  • interface?
  • self?
  • $this?
  • use?
  • annotations?
  • visibility:
    • private: only in this class
    • protected: only in derived classes
    • public: everywhere
  • ctor
function __construct() {
  parent::__construct(); // has to be called explicitly
  ...
}
  • dtor
function __destruct() {
  parent::__destruct(); // has to be called explicitly
}