<?php $globalFunction = function($var){ echo "works $var"; }; class TestClass{ private $globalFunction; function __construct(){ $this->globalFunction = $GLOBALS['globalFunction']; } function testFunc(){ ($this->globalFunction)('a'); } } $arr = new TestClass(); $arr->testFunc();
You have javascript disabled. You will not be able to edit any code.