File tree Expand file tree Collapse file tree 2 files changed +38
-3
lines changed
Expand file tree Collapse file tree 2 files changed +38
-3
lines changed Original file line number Diff line number Diff line change 1- php-behaviour
2- =============
3-
41List of PHP behaviours you don't expect
2+ =======================================
3+
4+ * String/Integer/Resource comparison
5+ * [ Change boolean constants TRUE/FALSE] ( change_boolean_constants.md )
6+ * Type conversion on array keys
7+ * Late constants linking
8+ * Reference returning
Original file line number Diff line number Diff line change 1+ Change boolean constants TRUE/FALSE (within a namespace)
2+ ========================================================
3+
4+ Example:
5+ --------
6+ (http://3v4l.org/hq7Jj )
7+
8+ Because TRUE and FALSE are constants of the root namespace
9+ you can define your own constants within another namespace.
10+
11+ ``` php
12+ namespace Foo;
13+ define('Foo\\true', \false);
14+ define('Foo\\false', \true);
15+
16+ var_dump(array(
17+ 'true' => true,
18+ 'false' => false,
19+ '1===1' => 1===1,
20+ '1!==1' => 1!==1,
21+ ));
22+ ```
23+
24+ ```
25+ array(4) {
26+ ["true"] => bool(false),
27+ ["false"] => bool(true),
28+ ["1===1"] => bool(true),
29+ |"1!==1"] => bool(false)
30+ }
31+ ```
You can’t perform that action at this time.
0 commit comments