I've been asked to create a class that does some stuff, and then returns an object with read only properties.. Now I've created the class and I've got everything working 100%, however I'm confused when they say to 'return an object with read only properties'.
This is the outline of my php file which contains the class and some extra lines calling it etc:
class Book(){ protected $self = array(); function __construct{ //do processing and build the array } function getAttributes(){ return $this->self; //return the protected array (for reading) } } $book = new Book(); print_r($book->getAttributes()); How can I return an object or something?