Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'KelompokMakanan.php';
- class Manusia extends KelompokMakanan
- {
- public $jenis_kelamin;
- public $nama;
- public $tanggal_lahir;
- public function bersuara()
- {
- return $this->nama;
- }
- public function usia()
- {
- $date = date_create_from_format("d/m/Y", $this->tanggal_lahir);
- $tahunLahir = $date->format('Y');
- $tahunSekarang = date('Y');
- $usia = $tahunSekarang - $tahunLahir;
- return $usia;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement