This is my class code:
class myClass
{
public function myFunc()
{
$myvar = \'Test str\';
}
public function result()
{
echo myClas
You are mixing up quite a few concepts.
First, you have to create a new object of class myClass
:
$nCls = new myClass();
Then, you can call the member function (method) on that class:
$nCls->result();
In result()
, you just call the other method using $this
:
public function result()
{
echo $this->myFunc();
}
Note though that this does nothing. The variable $myvar
is local and not a class attribute. I advise you read up on object oriented programming, and object oriented PHP in particular.