Jnr PHP/Codeigniter Developer Question:

Download Job Interview Questions and Answers PDF

Tell us how do you create a persistent cookie in php?

Jnr PHP/Codeigniter Developer Interview Question
Jnr PHP/Codeigniter Developer Interview Question

Answer:

Cookies will only persist for the time you define. To do it for 1 year you can simply do:

setcookie( "cookieName", 'cookieValue', strtotime( '+1 year' ) ); //set for 1 year

Download Jnr PHP/Codeigniter Developer Interview Questions And Answers PDF

Previous QuestionNext Question
Explain me what do you call the constructor of a parent class?Tell me are objects in PHP 5+ passed by value or reference?