You don't have to worry about that. If you have used C++, it's easier to understand how it works, but I guess you haven't.
Using define() you just say the server that you want to replace each HOME, WARNING, COPYRIGHT, etc into whatever you define them to. constant function is not necessary, but using it you will always be 100% sure that it's going to print value of defined word. I'm not sure what constant returns if it's undefined, you should check it. I'm not sure how it is done exactly in PHP, but in C++ it works like this:
you write your code, let's say like this:
Code:
#include <iostream>
#define HELLO "Hello World!\n"
int main()
{
std::cout << HELLO;
return 0;
}
And when you run the compiler, it goes through the code line by line doing pre-compile tasks (it's those lines with # at the beginning) first. So it find that HELLO is defined as "Hello World!\n" (every symbol is marked as definition, even quotes). So now wherever it finds HELLO, it gonna replace it with "Hello World!\n". So before running the actual compilation, the file copy will look like this:
Code:
//lots of lined included from <iostream>
int mai()
{
std::cout << "Hello World!\n";
return 0;
}
In PHP it works similar way. Every definitions is held in a special variable and if the compiler finds exactly the same (case-sensitive) characters sequence, it gonna be replaced by whatever you define.
P.S. As I said, i'm not 100% sure how PHP does it exactly, but it has to be included before the code where you use those defined words. In other words, the server must first read your definitions and only then it can replace it. You can't include lang.php at the end of file, because the server is not going to understand what you actually want by typing HOME because it hasn't read it yet.
P.S.S. Definitions can be both lower and upper case, but it's a coding style that it's usually upper case only.
Hopefully you understood.