<?php class Box { var $contents; function Box($contents) { $this->contents = $contents; } function get_whats_inside() { return $this->contents; } } ?>
I am going through a OO tutorial. I am familiar with PHP and the concept of OO but it is still an uphill struggle most of the time! However, the code above returns the error ‘Unexpected & on line 7’. I cannot find anyone else having had problems with the tutorial. I am running MAMP with php version 5.2.5. Anyone have any ideas?
It should read $this->contents instead of $this->contents