public static function set($identifier, $value)
    {
        list($hash, $keys) = self::_parseIdentifier($identifier);

        // Add to _REQUEST hash if original hash is get, post, or cookies
        if (in_array($hash, array('GET', 'POST', 'COOKIE'))) {
            self::set('request.'.implode('.', $keys), $value);
        }

        // Store cookies persistently
        if ($hash == 'COOKIE' && strpos(AnRequest::scheme(), 'http') !== false) {
            // rewrite the $keys as foo[bar][bar]
            $ckeys = $keys; // get a copy
            $name = array_shift($ckeys);
            foreach ($ckeys as $ckey) {
                $name .= '['.$ckey.']';
            }

            if (! setcookie($name, $value)) {
                throw new AnRequestException("Couldn't set cookie, headers already sent.");
            }
        }

        // Store in $GLOBALS
        foreach (array_reverse($keys, true) as $key) {
            $value = array($key => $value);
        }

        // Add the global if it's doesn't exist
        if (! isset($GLOBALS['_'.$hash])) {
            $GLOBALS['_'.$hash] = array();
        }

        $GLOBALS['_'.$hash] = AnHelperArray::merge($GLOBALS['_'.$hash], $value);
    }
public static function set($identifier, $value)
    {
        list($hash, $keys) = self::_parseIdentifier($identifier);

        // Add to _REQUEST hash if original hash is get, post, or cookies
        if (in_array($hash, array('GET', 'POST', 'COOKIE'))) {
            self::set('request.'.implode('.', $keys), $value);
        }

        // Store cookies persistently
        if ($hash == 'COOKIE' && strpos(AnRequest::scheme(), 'http') !== false) {
            // rewrite the $keys as foo[bar][bar]
            $ckeys = $keys; // get a copy
            $name = array_shift($ckeys);
            foreach ($ckeys as $ckey) {
                $name .= '['.$ckey.']';
            }

            if (! setcookie($name, $value)) {
                throw new AnRequestException("Couldn't set cookie, headers already sent.");
            }
        }

        // Store in $GLOBALS
        foreach (array_reverse($keys, true) as $key) {
            $value = array($key => $value);
        }

        // Add the global if it's doesn't exist
        if (! isset($GLOBALS['_'.$hash])) {
            $GLOBALS['_'.$hash] = array();
        }

        $GLOBALS['_'.$hash] = AnHelperArray::merge($GLOBALS['_'.$hash], $value);
    }
public static function set ( $ identifier , $ value ) { list ( $ hash , $ keys ) = self :: _parseIdentifier ( $ identifier ) ; // Add to _REQUEST hash if original hash is get, post, or cookies if ( in_array ( $ hash , array ( 'GET' , 'POST' , 'COOKIE' ) ) ) { self :: set ( 'request.' . implode ( '.' , $ keys ) , $ value ) ; } // Store cookies persistently if ( $ hash == 'COOKIE' && strpos ( AnRequest :: scheme ( ) , 'http' ) !== false ) { // rewrite the $keys as foo[bar][bar] $ ckeys = $ keys ; // get a copy $ name = array_shift ( $ ckeys ) ; foreach ( $ ckeys as $ ckey ) { $ name .= '[' . $ ckey . ']' ; } if ( ! setcookie ( $ name , $ value ) ) { throw new AnRequestException ( "Couldn't set cookie, headers already sent." ) ; } } // Store in $GLOBALS foreach ( array_reverse ( $ keys , true ) as $ key ) { $ value = array ( $ key => $ value ) ; } // Add the global if it's doesn't exist if ( ! isset ( $ GLOBALS [ '_' . $ hash ] ) ) { $ GLOBALS [ '_' . $ hash ] = array ( ) ; } $ GLOBALS [ '_' . $ hash ] = AnHelperArray :: merge ( $ GLOBALS [ '_' . $ hash ] , $ value ) ; }
Set a variable in the request. Cookies and session data are stored persistently.

@param   mixed   Variable identifier, prefixed by hash name eg post.foo.bar
@param   mixed   Variable value
Set a variable in the request . Cookies and session data are stored persistently .