In PHP 5 I can declare a const value to a class:
class config
{
const mailserver = 'mx.google.com';
}
But I can also declare public static:
class config
{
public static $mailserver = 'mx.google.com';
}
In case of a configuration file which I will later use, like:
imap_connect(config::$mailserver ...
imap_connect(config::mailserver ...
Which of the options do you think is better to be used? (Faster, less memory load, etc…)
The static variable can be changed, the const one cannot. The main consideration should be given to whether the config variables should be able to be altered at run time, not which is faster. The speed difference between the two (if there is any) is so minimal it isn’t worth thinking about.