I'm having problems with the method call style MyClass::function();and can't figure out why. Here is an example (I am using the Kohana btw framework):
class Test_Core
{
public $var1 = "lots of testing";
public function output()
{
$print_out = $this->var1;
echo $print_out;
}
}
I am trying to use the following to call it, but it returns $ var1 as undefined:
Test::output()
However, this works great:
$test = new Test();
$test->output();
I usually use this style of calling objects as opposed to the style of the "new class", but I cannot understand why it does not want to work.
source
share