Class Getter Method

Getters are methods used to access the values of a property. Getters may include some formatting.

Getters are usually created with a setter method.

<?php

class x {
    private $property;

    public function getProperty() {
        return $this->property;
    }
}

?>

Documentation

Related : Classes, Class Setter Method, Class Wither Method

Added in PHP 5.0+