xref: /PHP-7.4/Zend/tests/018.phpt (revision 782352c5)
1--TEST--
2constant() tests
3--FILE--
4<?php
5
6var_dump(constant());
7var_dump(constant("", ""));
8var_dump(constant(""));
9
10var_dump(constant(array()));
11
12define("TEST_CONST", 1);
13var_dump(constant("TEST_CONST"));
14
15define("TEST_CONST2", "test");
16var_dump(constant("TEST_CONST2"));
17
18echo "Done\n";
19?>
20--EXPECTF--
21Warning: constant() expects exactly 1 parameter, 0 given in %s on line %d
22NULL
23
24Warning: constant() expects exactly 1 parameter, 2 given in %s on line %d
25NULL
26
27Warning: constant(): Couldn't find constant  in %s on line %d
28NULL
29
30Warning: constant() expects parameter 1 to be string, array given in %s on line %d
31NULL
32int(1)
33string(4) "test"
34Done
35