Monday, April 30, 2012

cookie and array

hi
 i want send array to some cookie and then i want push some values to this array in cookie.
for example:
in cookie i have this:
array()
then
array([0]=>1)
then
array([0]=>1,[1]=>2)
then
array([0]=>1,[1]=>2...)

this is my code:

        $arr=$this->Cookie->read('braceletid');
                array_push($arr,$id);
        $this->Cookie->write('braceletid', $arr);

        pr($this->Cookie->read('braceletid'));

i want use this array like this.

example:

if (in_array(1,cookie array){
echo 'yes';
}

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: