summaryrefslogtreecommitdiff
path: root/tests/classes/method_call_variation_001.phpt
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2013-03-14 05:42:27 +0000
committer <>2013-04-03 16:25:08 +0000
commitc4dd7a1a684490673e25aaf4fabec5df138854c4 (patch)
tree4d57c44caae4480efff02b90b9be86f44bf25409 /tests/classes/method_call_variation_001.phpt
downloadphp2-master.tar.gz
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'tests/classes/method_call_variation_001.phpt')
-rw-r--r--tests/classes/method_call_variation_001.phpt37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/classes/method_call_variation_001.phpt b/tests/classes/method_call_variation_001.phpt
new file mode 100644
index 0000000..dd43cfd
--- /dev/null
+++ b/tests/classes/method_call_variation_001.phpt
@@ -0,0 +1,37 @@
+--TEST--
+In $a->$b[Y](), $b[Y] represents a method name on $a. But in $a->X[Y](), $a->X[Y] represents a global function name.
+--FILE--
+<?php
+ class C
+ {
+ function foo($a, $b)
+ {
+ echo "Called C::foo($a, $b)\n";
+ }
+ }
+
+ $c = new C;
+
+ $functions[0] = 'foo';
+ $functions[1][2][3][4] = 'foo';
+
+ $c->$functions[0](1, 2);
+ $c->$functions[1][2][3][4](3, 4);
+
+
+ function foo($a, $b)
+ {
+ echo "Called global foo($a, $b)\n";
+ }
+
+ $c->functions[0] = 'foo';
+ $c->functions[1][2][3][4] = 'foo';
+
+ $c->functions[0](5, 6);
+ $c->functions[1][2][3][4](7, 8);
+?>
+--EXPECTF--
+Called C::foo(1, 2)
+Called C::foo(3, 4)
+Called global foo(5, 6)
+Called global foo(7, 8)