Closed Crypto2 closed 3 years ago
Variables must be defined on the same scope (file) for their entire lifetime. You cannot import variables from foreign files. Only functions declaration, constants, and classes can be declared outside but not variables (eg. Object instantiation on your typical case).
Ah, OK; you may want to add it to the docs as a difference from PHP or maybe I just missed it. Are there any plans to change that in the future to match PHP?
I'm defining a class in a require()'ed file and making an instance in it, but in the parent file I get an error when trying to call the functions. On some level it knows they are there since if I check the instance with get_class_methods() it shows the methods.
I have attached a minimal example and if I execute test.php I get this error:
test.inc.php Warning: Call to undefined function '[__TestClass@Hello_eljexvpoer]',NULL will be returned
Oddly enough this is a distinctly different error than if I try to call a function that doesn't actually exist like $inst->Hello2():
test.inc.php Error: Undefined class method 'TestClass->Hello2',PH7 is loading NULL test.inc.php Warning: Invalid function name,NULL will be returned
test.zip