dcsimg
July 18, 2018
Hot Topics:

The New Features in PHP 5 Constructors and Destructors

  • December 28, 2010
  • By Glen Kunene
  • Send Email »
  • More Articles »

Constructors and destructors are among the most important functions in any type of object-orientated class. In PHP, the new OOP features in PHP 5 offer a number of advantages over PHP 4 when you use constructor and destructor functions. In her PHPBuilder article The New PHP 5 Features for Constructors and Destructors, Octavia Andreea Anghel introduces PHP 5 constructors and destructors, comparing them with the old PHP 4 constructors and explaining how to write them for various uses.

First, she provides a refresher of the functions:

... a constructor is a special function of a class that is automatically executed whenever an object of a class gets instantiated. A destructor is a special function of a class that is automatically executed whenever an object should be destroyed.

By the end of the article, you'll be able to write almost any kind of constructor for your PHP 5 classes.

 

Read the full story at PHPBuilder:
The New PHP 5 Features for Constructors and Destructors



Originally published on https://www.developer.com.


Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

By submitting your information, you agree that developer.com may send you developer offers via email, phone and text message, as well as email offers about other products and services that developer believes may be of interest to you. developer will process your information in accordance with the Quinstreet Privacy Policy.

Sitemap

Thanks for your registration, follow us on our social networks to keep up-to-date