xref: /PHP-7.2/Zend/tests/008.phpt (revision 17ccbeec)
1--TEST--
2define() tests
3--FILE--
4<?php
5
6var_dump(define());
7var_dump(define("TRUE"));
8var_dump(define("TRUE", 1));
9var_dump(define("TRUE", 1, array(1)));
10
11var_dump(define(array(1,2,3,4,5), 1));
12var_dump(define(" ", 1));
13var_dump(define("[[[", 2));
14var_dump(define("test const", 3));
15var_dump(define("test const", 3));
16var_dump(define("test", array(1)));
17var_dump(define("test1", new stdclass));
18
19var_dump(constant(" "));
20var_dump(constant("[[["));
21var_dump(constant("test const"));
22
23echo "Done\n";
24?>
25--EXPECTF--
26Warning: define() expects at least 2 parameters, 0 given in %s on line %d
27NULL
28
29Warning: define() expects at least 2 parameters, 1 given in %s on line %d
30NULL
31bool(true)
32
33Warning: define() expects parameter 3 to be boolean, array given in %s on line %d
34NULL
35
36Warning: define() expects parameter 1 to be string, array given in %s on line %d
37NULL
38bool(true)
39bool(true)
40bool(true)
41
42Notice: Constant test const already defined in %s on line %d
43bool(false)
44bool(true)
45
46Warning: Constants may only evaluate to scalar values or arrays in %s on line %d
47bool(false)
48int(1)
49int(2)
50int(3)
51Done
52