Skip to content

Document accessing superglobals directly #90

@jasalt

Description

@jasalt

Found a possible gap in the docs while figuring out how to connect to WordPress (MySQL) database from Phel which requires accessing the wpdb object via PHP superglobals.

I was looking for something equivalent to the PHP global statement first (generally recommended with wpdb), but the alternative method by accessing $GLOBALS superglobals array seemed more feasible.

Figured to access the $GLOBALS array then with (get php/$GLOBALS "wpdb") after reading Phel http library sources that I knew to be messing with the superglobals.

Docs didn't really give any good pointers about this so maybe it could be worth to mention something about it in eg. "Global and local bindings" or "PHP interop" or both as they'd seem the most logical places, if this would be considered a general enough issue? I'm not very familiar with the PHP ecosystem at large but find this somewhat frequent related to WP at least.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationgood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions