Quote:
Originally Posted by TwinkiDaBoss
Hmm interesting way to do it, but why are you making a new object? Cant we just push the stuff without making it? Ie without having new stdClass?
Note: Altho hmm seems that I even get a problem with that
Код:
Fatal error: Call to undefined method stdClass::function()
Sample code
PHP код:
<?php
include "core/bootstrap.php";
$testObject = new stdClass;
$testObject->pass = '';
$testObject->function = function() {
echo $this->pass;
};
Event::on("GameModeInit", function() use ($testObject) {
$testObject->function();
});
?>
|
My fault, you can't use functions inside a stdClass object. But it was an example of what is possible to insert inside a function parameter. You can for example insert a whole User class, and call the function of it inside that function/closure function.