I'm attempting to learn OOP PHP using a tutorial I found on the web. I'm running the code in an OS X terminal. The code is:
When I run it, I get this error:
This code was copied exactly from the tutorial, so I thought it should work. Can anyone help me out?
Thanks,
Peter V.
Code:
<? php
class Box
{
var $contents;
function Box($contents) {
$this->contents = $contents;
}
function get_whats_inside() {
return $this->contents;
}
}
$mybox = new Box("Jack");
echo $mybox->get_whats_inside();
?>
Code:
Parse error: syntax error, unexpected T_CLASS in Box.php on line 3
This code was copied exactly from the tutorial, so I thought it should work. Can anyone help me out?
Thanks,
Peter V.