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;
    }
}

?>

Documentation

See also What are getters and setters methods in PHP?

Related : Classes, Class Getter Method, Class Wither Method

Added in PHP 5.0+