Quick actions

cmd+k|ctrl+k

Navigation

Languages

class

Snippet info

Language

Php

Visibility

public

Author

asepkhabril20

Created

2022-09-03T09:43:07.97958Z

Updated

2022-09-03T09:56:22.83067Z

<?php
class Hewan {
    // property
    public $bernafas = 'Paru-paru';
    public $berjalan;
    
    // method
    public function berjalan($pipit){
        echo $this->berjalan=' terbang';
        return $pipit;
        $kaki=1;
    }
    public function nafas(){
      return $this->bernafas;  
    } 
}

$burung = new Hewan;
// untuk mengakses property class menggunakan tanda '->' diikuti nama property tanpa tanda $

echo $burung->nafas();
echo $burung->berjalan('burung');
INFO