Broadcast on Broadcast off
The Documentation for Project Zero has moved. Please update your bookmarks to: http://www.projectzero.org/documentation/
Table of
Contents...
Hide
 

zget

This function allows PHP scripts to retrieve values from the Global Context using the specified key. Keys in the Global Context are divided in to zones. The zone is the first path segment of the key. If a key does not exist in the Global Context then null is returned and the script continues running. The script can provide an optional second argument that serves as the default value for the key if the key does not exist.

The Zero runtime populates the Global Context with a initial set of keys and values depending on the configuration and the request. A script developer may add to this by creating a script/application specific key using the zput() function

The following are valid keys /request/headers/in/Content-Type with a zone of /request /config/name with a zone of /config.

NOTE: The function get() has been deprecated and will be removed. Please use zget() instead.

Description

mixed zget (string key, mixed defaultValue)

Parameters:

string key - a Global Context key
mixed defaultValue - optional default value of the key does not exist in the Global Context

Return:

mixed - the value associated with the key

Aliases

get

PHP.INI settings

extension = zero.php.ZeroExtension

Examples

<?php
// Get the application name from the Global Context's config zone
$applicationName = zget('/config/name');

// Get the Content-Type request header from the Global Context's request zone
$contentType = zget('/request/headers/in/Content-Type');

?>

r4 - 28 Jan 2008 - 13:56:09 - zerodocgen
Syndicate this site RSS ATOM
Copyright 2007 © IBM Corporation | Privacy | Terms of Use | About this site