Here's how my code codes:
class MyClass()
{
private $var;
public function SetVarManually($somevar)
{
$this->var=$somevar;
}
private function IWillUseThisLater($symbol)
{
if($symbol=='*') return 1;
if($symbol=='+') return 0;
}
public function SetVarDifferently()
{
$this->var=strval(IWillUseThisLater('*'));
}
}
$instance=new MyClass;
$instance->SetVarManually('random string'); // this works.
$instance->SetVarDifferently(); // this gives and undefined function error,
//more precisely that IWillUseThisLater is undefined.


Sign In
Create Account


Back to top









