125k views
4 votes
In PHP the availability of a constant is always global
A)True
B)False

User Marcin D
by
7.8k points

1 Answer

4 votes

Final answer:

In PHP, constants are always globally available, and can be accessed globally without using a global keyword once they are defined using the define() function or the const keyword.

Step-by-step explanation:

In PHP, the availability of a constant is always global. This means that once a constant is defined, it can be accessed from any part of the script, regardless of the scope. Constants are defined using the define() function, or since PHP 5.3.0, the const keyword. Unlike variables, which have both global and local scope, constants do not need a global keyword to be accessed within functions or methods.

User Alexdets
by
8.7k points