Re: Accessing PHP globals from a module.
| From: | Rasmus Lerdorf | Date: | Tue, 21 May 2002 15:03:36 +0000 |
| Subject: | Re: Accessing PHP globals from a module. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-98605@lists.php.net to get a copy of this message | ||
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.
-Rasmus
On Tue, 21 May 2002, Eric Veldhuyzen wrote:
> Hi,
>
> I have just written a module for PHP (in C, linked with PHP statically).
> Now I need to access session variables and other globals from whithin my
> module. But I can't find how I should do this, I see documentation on
> how
> to call user functions, and how to create new global varables, but now
> how to access existing globals. Could somebody please tell me where
> tell me where this is documented if it is documented at all, or explain
> it to me if it is not documented yet?
>
> --
> #!perl # Life ain't fair, but root passwords help.
> # Eric Veldhuyzen eric@terra.telemediair.nl
> $!=$;=$_+(++$_);($:,$~,$/,$^,$*,$@)=$!=~ # Perl Monger
> /.(.)...(.)(.)....(.)..(.)..(.)/;
$^$~$/$: $^$*$@$~
> $_>&$;
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>