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();
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.