Reference PHP Class function method

php

Solution

You assign it like so:

$v = 'checkDemo';
$this->$v('hello');

Check out the documentation for more examples.

Although I'm not entirely sure why you'd do it, that's how.

Problem

I have a class: ``` class demo { function newDemo(){ $v=$this->checkDemo; $v('hello'); // not working this reference, or how to do this? } function checkDemo($a){ ... return $a; } } ``` So, how can i reference checkDemo function method inside class?

Original source