Re: Accessing PHP globals from a module.
| From: | Rasmus Lerdorf | Date: | Wed, 22 May 2002 13:36:12 +0000 |
| Subject: | Re: Accessing PHP globals from a module. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-98736@lists.php.net to get a copy of this message | ||
> On Tue, May 21, 2002 at 08:03:36AM -0700, Rasmus Lerdorf wrote:
> > Depends a bit on what sort of globals you are after. If you mean a global
> > variable set by the user in the global symbol table you would do:
> >
> > pval **tmp;
> > if(zend_hash_find(&EG(symbol_table), "foo", 3, (void **)&tmp) ==
> > SUCCESS) {
> > RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
> > } else {
> > RETURN_FALSE;
> > }
> >
> > Would fetch $foo from the global symbol table, stick it in tmp and return
> > it from your function.
>
> I might be able to use this, but what I am really after is getting
> values from the session variables, like $_SESSION["id"]. Is this
> possible at all and if so, is this documented somewhere?
Yup, in ext/session/session.c
-Rasmus