From 360c543e49cd4b88bfb1ddfb2e6c466ceb570e8a Mon Sep 17 00:00:00 2001 From: Chemaclass Date: Fri, 29 Nov 2024 18:40:35 +0100 Subject: [PATCH 1/2] docs: add Accessing super-globals to PHP Interop page --- content/documentation/php-interop.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/content/documentation/php-interop.md b/content/documentation/php-interop.md index 39f4e864..ff196a8a 100644 --- a/content/documentation/php-interop.md +++ b/content/documentation/php-interop.md @@ -3,6 +3,15 @@ title = "PHP Interop" weight = 14 +++ +## Accessing super-globals + +Use the `php/` prefix to access the global variables in combination with `get`. + +```phel +(get php/$_SERVER "key") # Similar to $_SERVER['key'] +(get php/$GLOBAL "wpdb") # Similar to $GLOBAL['wpdb'] +``` + ## Calling PHP functions PHP comes with huge set of functions that can be called from Phel by just adding a `php/` prefix to the function name. From 1d4ccd38aff2bf772ba4a790bb97a3d1cafceaa0 Mon Sep 17 00:00:00 2001 From: Chemaclass Date: Fri, 29 Nov 2024 18:48:39 +0100 Subject: [PATCH 2/2] docs: use argv instead of wpdb for the example --- content/documentation/php-interop.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/documentation/php-interop.md b/content/documentation/php-interop.md index ff196a8a..2de1032e 100644 --- a/content/documentation/php-interop.md +++ b/content/documentation/php-interop.md @@ -9,7 +9,7 @@ Use the `php/` prefix to access the global variables in combination with `get`. ```phel (get php/$_SERVER "key") # Similar to $_SERVER['key'] -(get php/$GLOBAL "wpdb") # Similar to $GLOBAL['wpdb'] +(get php/$GLOBAL "argv") # Similar to $GLOBAL['argv'] ``` ## Calling PHP functions