Tag Archives: destructor

PHP: Don’t Call the Destructor Explicitly

“PHP 5 introduces a destructor concept similar to that of other object-oriented languages, such as C++”[1] says the documentation for destructors, but let’s see the following class.

class A
	public function __construct()
		echo 'building an object';
	public function __destruct()
		echo 'destroying the object';
$obj = new A();

Well, as you can not call the constructor explicitly:


So we should not call the destructor explicitly:


The problem is that I’ve seen this many times, but it’s a pity that this won’t destroy the object and it is still a valid PHP code.
Continue reading PHP: Don’t Call the Destructor Explicitly

jQuery datepicker persist defaultDate

Datepicker from jQuery

You know how the jQuery UI extensions give a useful functionality for the javascript developers. The datepicker is a useful calendar tool that comes with variaty of functions.

How to setup the selected / defaultDate

It’s as simple as these lines of code:

    defaultDate : d,

The problem

The problem is when you attach this datepicker constructor to a div which is hidden, and than you make it visible like so: Continue reading jQuery datepicker persist defaultDate