Macros for Automatic Global Variable Creation

In addition to the macros discussed earlier, a few macros allow easy creation of simple global variables. These are nice to know in case you want to introduce global flags, for example. This is somewhat bad practice, but Table 9.12 describes macros that do exactly this task. They don't need any zval allocation; you simply have to supply a variable name and value.

Note: All macros in Table 9.12 create a global variable of the name name with the value value.

Table 9.12. Macros for Global Variable Creation
MacroDescription
SET_VAR_STRING(name, value)Creates a new string.
SET_VAR_STRINGL(name, value, length)Creates a new string of the specified length. This macro is faster than SET_VAR_STRING and also binary-safe. ...

Get Web Application Development with PHP 4.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.