xref: /PHP-7.0/Zend/tests/ns_040.phpt (revision 7126de49)
1--TEST--
2040: Constant declaration and usage in namespace
3--FILE--
4<?php
5namespace X;
6use X as Y;
7const A = "ok\n";
8const B = A;
9function f1($x=A) {
10	echo $x;
11}
12function f2($x=\X\A) {
13	echo $x;
14}
15function f3($x=Y\A) {
16	echo $x;
17}
18function f4($x=\X\A) {
19	echo $x;
20}
21function f5($x=B) {
22	echo $x;
23}
24function f6($x=array(A)) {
25	echo $x[0];
26}
27function f7($x=array("aaa"=>A)) {
28	echo $x["aaa"];
29}
30function f8($x=array(A=>"aaa\n")) {
31	echo $x["ok\n"];
32}
33echo A;
34echo \X\A;
35echo Y\A;
36echo \X\A;
37f1();
38f2();
39f3();
40f4();
41echo B;
42f5();
43f6();
44f7();
45f8();
46--EXPECT--
47ok
48ok
49ok
50ok
51ok
52ok
53ok
54ok
55ok
56ok
57ok
58ok
59aaa
60