<?php
class time{
private $hour=0;
private $min=0;
private $sek=0;
public function __construct($h,$m,$s){
$this->sethour($h);
$this->setmin($m);
$this->setsek($s);
}
public function __destruct(){
$this->showtime();
}
public function showtime(){
echo $this->hour.' : '.$this->min.' : '.$this->sek;
}
public function sethour($hour){
if(gettype($hour)=='integer' && $hour<=23 && $hour>=0){
$this->hour=$hour;
}
}
public function setmin($min){
if(gettype($min)=='integer' && $min<=59 && $min>=0){
$this->min=$min;
}
}
public function setsek($sek){
if(gettype($sek)=='integer' && $sek<=59 && $sek>=0){
$this->sek=$sek;
}
}
public function gethour(){
return $this->hour;
}
public function getmin(){
return $this->min;
}
public function getsek(){
return $this->sek;
}
}
$t=new time(15,22,38);
echo $t=new showtime();