Jump to content

[SOLVED] Need some more OOP help.


unkwntech

Recommended Posts

I have the following code:

class myClass
{
	public $myVar;
	public function __CONSTRUCT()
	 {
		$self->myVar= $self->myFunc(); //Error Here
	 }
        private function myFunc()
         {
                return 'Hello World';
         }
}
$var = new myClass;
echo $var->myVar;

 

I am getting this error:

<b>Fatal error</b>:  Call to a member function myFunc() on a non-object

 

Link to comment
https://forums.phpfreaks.com/topic/134893-solved-need-some-more-oop-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.