While reading about PHP constructors, I came across the below example on this page.
<?php
class MyClass {
// use a unique id for each derived constructor,
// and use a null reference to an array,
// for optional parameters
function __construct($id="", $args=null) {
// parent constructor called first ALWAYS
/*Remaining code here*/
}
}
I am not able to understand why $id is set to "" and $args to null. When would I use something like this? Why can't we just use function __construct($id, $args) {.