You are here: Re: [PHP] incrementing cookie « PHP « IT news, forums, messages
Re: [PHP] incrementing cookie

Posted by Jochem Maas on 09/14/05 15:57

Ross wrote:
> Hi,
>
> I want to increment a cookie by 1 every time a click a button
>
> if (isset($add) {
>
> $number++;
> setcookie("cookie[number]", "$number Is the number")
>
> }
>
> I know I should retireve the cookie value for $number but the problem is it
> has 2 bits, a number and a bit of text.

in your case this can be done simply:

$number = 99;
$string = "$number Is the number";
echo "the number is ",intval($string),"\n";

this works because the number is at the start of the string...
(and because of the cool way the made type conversion work in php)
to find out more search/read the manual on the subject of
typecasting/conversion.

>
>
> Thanks,
>
> Ross
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация