xref: /PHP-7.0/Zend/tests/023.phpt (revision 8f2c31a1)
1--TEST--
2Testing variable variables as function name
3--FILE--
4<?php
5
6$a = 'ucfirst';
7$b = 'a';
8print $$b('test');
9print "\n";
10
11
12class bar {
13	public function a() {
14		return "bar!";
15	}
16}
17
18class foo {
19	public function test() {
20		print "foo!\n";
21		return new bar;
22	}
23}
24
25function test() {
26	return new foo;
27}
28
29$a = 'test';
30$b = 'a';
31var_dump($$b()->$$b()->$b());
32
33
34$a = 'strtoupper';
35$b = 'a';
36$c = 'b';
37$d = 'c';
38var_dump($$$$d('foo'));
39
40?>
41--EXPECT--
42Test
43foo!
44string(4) "bar!"
45string(3) "FOO"
46