<?php function my_class($x) { return new class() { public function myMeth() { return $x; } }; } $c = my_class(10); var_dump($c->myMeth());
You have javascript disabled. You will not be able to edit any code.