Class Setter Method
Setters are methods used to give the values of a property. Setters may apply some filtering and validation before accepting the value.
Setters are usually created with a getter method.
<?php
class x {
private $property;
public function setProperty($value) {
$this->property = $value;
}
}
?>
See Also
- What are getters and setters methods in PHP?
- The Magic of PHP Getters, Setters, and Readonly Classes: Crafting Clean and Efficient Code