023.phpt 523 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. --TEST--
  2. Testing variable variables as function name
  3. --FILE--
  4. <?php
  5. $a = 'ucfirst';
  6. $b = 'a';
  7. print $$b('test');
  8. print "\n";
  9. class bar {
  10. public function a() {
  11. return "bar!";
  12. }
  13. }
  14. class foo {
  15. public function test() {
  16. print "foo!\n";
  17. return new bar;
  18. }
  19. }
  20. function test() {
  21. return new foo;
  22. }
  23. $a = 'test';
  24. $b = 'a';
  25. var_dump($$b()->$$b()->$b());
  26. $a = 'strtoupper';
  27. $b = 'a';
  28. $c = 'b';
  29. $d = 'c';
  30. var_dump($$$$d('foo'));
  31. ?>
  32. --EXPECT--
  33. Test
  34. foo!
  35. string(4) "bar!"
  36. string(3) "FOO"