Learn PHP Tutorial 24 Constructor and Destructor

Publicado em: 23 Outubro 2015
no canal de: Champion Mahipal
224
1

This video is made for learning about Constructor and Destructor in PHP.

Constructors and Destructors ¶

Constructor ¶

void __construct ([ mixed $args = "" [, $... ]] )
PHP 5 allows developers to declare constructor methods for classes. Classes which have a constructor method call this method on each newly-created object, so it is suitable for any initialization that the object may need before it is used.

Destructor ¶

void __destruct ( void )
PHP 5 introduces a destructor concept similar to that of other object-oriented languages, such as C++. The destructor method will be called as soon as there are no other references to a particular object, or in any order during the shutdown sequence.

Destructor


• These are special member functions.
• These are used to release the memory.
• These are invoked automatically when object of that class is destructed.
• It has no return type.
• No parameters can be passed.
• These are always public.

Constructor


• Constructors are used to initialize the value of object.
• These are special member functions.
• These are invoked automatically when object of that class is created.
• Its name is same as name of class.
• It has no return type.
• These are always public.


Nesta página do site você pode assistir ao vídeo on-line Learn PHP Tutorial 24 Constructor and Destructor duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Champion Mahipal 23 Outubro 2015, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 224 vezes e gostou 1 espectadores. Boa visualização!