How PHP macro define is interpreted? -
for c/c++, think preprocessor macro processing before compiler compiles program , that's why macro name has literal or absolute, no variable allowed declared macro name.
in case of php, can declare this: define($name, $value); means, interpreter first interprets variable , macro defined, i.e. runtime macro processing.
which creates doubt that, macro processing ? if not what's purpose of introducing such keyword 'define'; have values cannot changed ?
or if there's macro processing, can explain, how working ?
for sake of completeness, there is constant defined @ compile-time :
const my_constant = 'something';
as opposed defining constants using define(), constants defined using const keyword must declared @ top-level scope because defined @ compile-time. means cannot declared inside functions, loops or if statements.
this current php version, 5.3.
Comments
Post a Comment