Re: Basic OOP Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Hi,
> This is my first post so a cheery hello, this script from php.net:
> 
> 
> [www.php.net]
> 
> <?php
> class SimpleClass
> {
>     // member declaration
>     public $var = 'a default value';
> 
>     // method declaration
>     public function displayVar() {
>         echo $this->var;
>     }
> }
> 
> mySimpleClass = new SimpleClass();
> ?>

You need to change the last line there.

$mySimpleClass = new SimpleClass();

There's no '$'

> 
> 
> Returned this:
> Parse error: parse error, unexpected T_STRING, expecting T_FUNCTION
> in /Users/chris/Sites/php/oop/simple.php on line 4
> 
> 
> 
> I'm running  PHP Version 5.0.4, with MAC OS 10.4.4

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux