Re: What is a persistent constant (resend)

From: Date: Sat, 22 Jun 2002 14:00:47 +0000
Subject: Re: What is a persistent constant (resend)
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-85488@lists.php.net to get a copy of this message
At 06:44 AM 6/21/2002 -0400, fabwash wrote:
Hello, I already sent this question, but there was no answer, and i'm afraid it was not noticed, but if this is the wrong list, let me know :) When you define a constant you can use two things that are not very clear to me. Can someone explain? 1) CONST_PERSISTENT. How can a constant be persistent? The documentation says that the constant is not "forgotten" after the process stops. Well if the process stops, where is the constant stored? I couldn't find any place where the constant would be written to a file or some location. Then when then module is started again, all programs I have looked at register those same constants again, so what is the point of making them persistent? Something is not getting into my small brain, there. 2) REGISTER_MAIN_.. Those are supposed to remain in the symbol table. The only symbol table I see is the Zend constant symbol table. So if the process ends, then they're lost, and that's fine with me. But if a module registers a constant as MAIN, then gets unloaded, the constants stay, available for other modules I guess. So I understand REGISTER_MAIN (I think), although I don't really see the point, but i'm totally not clear about CONST_PERSISTENT. Anyone can explain?
Persistent constants survive in between requests. Usually this is used by extensions to define some constants such as the constant PREG_PATTERN_ORDER. It is registered at module startup. Of course it'll die if the Apache process dies. Andi

« previous php.dev (#85488) next »