When executing the code below, expecting to say that the apple is green
and later red I get the error
Parse error: parse error, expecting `T_VARIABLE' in /httpdocs/test01.php
on line 3
Any idea how I can fix this?
Thanks in advance,
Roderik
Expand|Select|Wrap|Line Numbers
- <?php
- class apple {
- var color;
- function apple() {
- color = "green";
- }
- }
- class banana {
- var color;
- function banana() {
- color = "green";
- }
- }
- var red_apple = new apple();
- var yellow_banana = new banana();
- ?>
- <html>
- <head></head>
- <body>
- <?
- print("The color of our apple is ".red_apple->color);
- red_apple->color = "red";
- print("Some weeks later the color of our apple is ".red_apple->color);
- ?>
- </body>
- </html>
http://www.archytas.nl/
webdesign, internet applicaties, internetgestuurde elektronica