fork download
  1. <?php
  2. class Test
  3. {
  4. function mamku()
  5. {
  6. return "mamky ebal";
  7. }
  8.  
  9. function __call($name, $arguments)
  10. {
  11. if (method_exists($this, $name)) {
  12. return $this->{$name};
  13. } else {
  14. throw new Exception();
  15. }
  16. }
  17. }
  18.  
  19. $test = new Test();
  20. $mamky = "mamku";
  21. var_dump($test->{$mamky}());
  22. // your code goes here
Success #stdin #stdout 0.02s 24448KB
stdin
Standard input is empty
stdout
    string(10) "mamky ebal"