Re: number of cookies and if there are any cookies set?
| From: | Ken | Date: | Tue, 26 Apr 2005 11:16:44 +0000 |
| Subject: | Re: number of cookies and if there are any cookies set? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-213899@lists.php.net to get a copy of this message | ||
On 4/26/05, AndreaD <andrea.davidson@silene.co.uk> wrote:
> I need two bits of info...
>
> (i) Are there ANY cookies set?
>
> (ii) How many cookies are set?
>
> how do I find this information out?
>
> AD
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
you can access cookies by using the superglobal variable (as an array) $_COOKIE.
if ( isset($_COOKIE['cookiename']) )
{
// do some stuff. cookie with cookiename is set.
}
i don't know the best method to check how many cookies are set but i
guess you count the array $_COOKIE.
$number = count($_COOKIE)
hope this helps.
Ken