Aer/tests/constants_access.aer
belliash 55acf8111f
All checks were successful
The build was successful.
Assume private visibility for all class members by default.
In most (all?) modern OOP languages class members visibility is assumed to be private and programmer has to consciously set it to public or protected. PHP has the different approach what can cause a security flaws in written scripts. AerScript will not follow this way, as it seems to be conceptually broken.
2019-05-17 08:40:41 +02:00

22 lines
490 B
Plaintext

define TEST_CONSTANT 'This is a global constant';
class Program {
const TEST_CONSTANT = 'This is a class constant';
private void constant_test() {
const TEST_CONSTANT = 'This is a local constant';
var_dump(TEST_CONSTANT);
}
public void main() {
int $var = 69;
var_dump(TEST_CONSTANT);
$this->constant_test();
var_dump(TEST_CONSTANT);
var_dump($this->TEST_CONSTANT);
const TEST_CONSTANT = 'Local constant overrides a global constant';
var_dump(TEST_CONSTANT);
}
}