• PHP Video Tutorials

PHP - Function setcookie



Syntax

bool setcookie ( string $name [, string $input = "" [, int $expire = 0 [, 
   string $path = "" [, string $domain = "" [, bool $secure = false [, 
   bool $httponly = false ]]]]]] )

Definition and Usage

It used to set the cookies

Return inputs

If cookies are successfully run than it will returns true,or else it will returns false

Parameters

Sr.No Parameters & Description
1

name

It contains Name of the cookies.

2

input

It contains the port number.

3

errno

It contains the information about cookies inputs.

4

expire

It contains expire time information about cookies

5

path

It contains the information about cookies path wherein server.

6

domain

It contains domain information.

Example

Try out following example

<?php
   $input = 'It contains Name of the cookies';
   
   setcookie("TestCookie", $input);
   setcookie("TestCookie", $input, time()+3600); 
   setcookie("TestCookie", $input, time()+3600, "/~rasmus/", "tutorialpoint.com", 1);
?>
php_function_reference.htm
Advertisements