SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | ||
| 3 | - | class Mahasiswa |
| 3 | + | |
| 4 | - | {
|
| 4 | + | function sum(int $a, int $b): int {
|
| 5 | - | private $nim; |
| 5 | + | return $a + $b; |
| 6 | - | private int $tahunMasuk = 2020; |
| 6 | + | |
| 7 | - | public string $nama = "Aldino Kemal"; |
| 7 | + | |
| 8 | - | protected string $alamat; |
| 8 | + | echo sum(4, 5); // 9 |
| 9 | echo sum(4.0, 5.2); // 9 | bukan 9.2 | |
| 10 |