I am using PHP Version 7.3.25.
I have started experimenting with PHP Namespaces on the server-side (not least because I use ESModules on the client-side and I fully appreciate the advantages of namespacing) but I have fallen at the first hurdle - it's probably an obvious rookie error, but with no errors displaying it's difficult to guess what mistake I've made.
I have a long page of global functions - included before anything else by every page on the website - which I have prepended with:
namespace mySetupmyFunctions;
On every page on the site, I include this long page of global functions, using:
include $_SERVER['DOCUMENT_ROOT'].'/my-setup/my-functions.php';
getMyPage();
I can't guess what is going wrong now because the result (for every page) is now an entirely blank page with no error.
Although the long page only contains functions (no classes), I wondered if I might need to change the function invocation getMyPage();
to:
mySetupmyFunctionsgetMyPage();
But that also doesn't work. So I'm a little lost, unable to even guess at what basic, low-level consideration is going wrong or which I've missed.
question from:
https://stackoverflow.com/questions/65859047/adding-a-namespace-to-the-top-of-my-php-functions-page-results-in-the-display-of 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…