I've used procedural for sometime now and trying to get a better understanding of OOP in Php. Starting at square 1 and I have a quick question ot get this to gel. Many of the basic examples show static values ( $bob->name = "Robert";) when assigning a value, but I want to pass values... say from a form ( $name = $_POST['name']; )
class Person {
// define properties
public $name;
public $weight;
public $age;
public function title() {
echo $this->name . " has submitted a request ";
}
}
$bob = new Person;
// want to plug the value in here
$bob->name = $name;
$bob->title();
Ben biraz kadarıyla sınıf, kapsülleme içinde & değişkenleri erişme gibi bazı alanlarda kapattı alıyorum sanırım "Kurallar", vs, isim = $ _POST ['isim'] $ olabilir; sınıf dışında herhangi bir yerde ikamet ya da ben önemli bir noktayı eksik?
Teşekkürler