Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<ob_inflatehandlerhttp_parse_headers>
Last updated: Tue, 19 Sep 2006

http_parse_cookie

(no version information, might be only in CVS)

http_parse_cookie -- Parse HTTP cookie

Description

object http_parse_cookie ( [string cookie [, int flags [, array allowed_extras]]] )

Parses HTTP cookies like sent in a response into a struct.

Parameters

cookie

String containing the value of a Set-Cookie response header

flags

Parse flags

allowed_extras

Array containing recognized extra keys. By default all unknown keys will be treated as cookie names.

Return Values

Returns an stdClass like shown in the example on success or FALSE on failure.

Examples

Example 1. Using http_parse_cookie()

<?php
print_r(http_parse_cookie("foo=bar; bar=baz; path=/; domain=example.com; comment=; secure", 0, array("comment")));
?>

The above example will output:

stdClass Object
(
  [cookies] => Array
  (
    [foo] => bar
    [bar] => baz
  )

  [extras] => Array
  (
    [comment] =>
  )

  [flags] => 16
  [expires] => 0
  [path] => /
  [domain] => example.com
)




<ob_inflatehandlerhttp_parse_headers>
Last updated: Tue, 19 Sep 2006