File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -3,15 +3,22 @@ title = "PHP Interop"
33weight = 14
44+++
55
6- ## Accessing super-globals
6+ ## Accessing global variables and named constants
77
8- Use the ` php/ ` prefix to access the global variables in combination with ` get ` .
8+ Use the ` php/ ` prefix to access the global variables (superglobals) in combination with ` get ` .
99
1010``` phel
1111(get php/$_SERVER "key") # Similar to $_SERVER['key']
1212(get php/$GLOBALS "argv") # Similar to $GLOBALS['argv']
1313```
1414
15+ Named constants set with PHP [ ` define ` ] ( https://www.php.net/manual/en/function.define.php ) can be accessed in Phel via ` php/CONSTANT_NAME ` .
16+
17+ ```
18+ (php/define "MY_SETTING" "My value") # Calls PHP define('MY_SETTING', 'My value");
19+ php/MY_SETTING # Returns "My value"
20+ ```
21+
1522## Calling PHP functions
1623
1724PHP comes with huge set of functions that can be called from Phel by just adding a ` php/ ` prefix to the function name.
You can’t perform that action at this time.
0 commit comments