Declaring and Using Object Constructors and Destructors
<?php
class cd {
public $artist;
public $title;
protected $tracks;
private $disk_id;
public function __construct() {
$this->disk_id = sha1('cd' . time() . rand());
}
public function get_disk_id() {
return $this->disk_id;
}
}
$mydisk = new cd();
echo $mydisk->get_disk_id();
?>