RE: [PHP] static variables
| From: | Miguel Guirao | Date: | Fri, 10 Feb 2006 15:02:16 +0000 |
| Subject: | RE: [PHP] static variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-230205@lists.php.net to get a copy of this message | ||
and static variables do not lose it's value as long as the script is not
called again!!
Since you are calling the script again, that's why the static variables lose
it's value!!
Miguel Guirao
-----Original Message-----
From: Hugh Danaher [mailto:hdanaher@earthlink.net]
Sent: Viernes, 10 de Febrero de 2006 12:45 a.m.
To: php-general@lists.php.net
Cc: suresh kumar
Subject: Re: [PHP] static variables
Suresh,
You could use the link to pass your variable to the next page, or to the
same page:
Instead of
$count=0;
use
if (!isset($_GET['count'])) $count=0;
Then for your link use
print "<a href=http://www.whatever.com?count=$count>link to new
page</a>"
or use
print "<a href=".$_SERVER['PHP_SELF']."?count=$count>link to same
page</a>"
if you want to return to the same page with an updated count.
HTH
HTD
----- Original Message -----
From: "suresh kumar" <asureshkumar_1983@yahoo.co.in>
To: <php-general@lists.php.net>
Sent: Thursday, February 09, 2006 9:50 PM
Subject: [PHP] static variables
> hai everbody
>
> i am facing a problem with static
> variable. i declared $count=0 as Static variable,when
> i click the link specified in anchor tag my page is
> refreshed again and static variable lose its value and
> assigned with 0.i want the logic code say my stsic
> variable will not lose scope when i click next,i am
> looking forward reply from u.
> A.suresh
>
>
>
> __________________________________________________________
> Yahoo! India Matrimony: Find your partner now. Go to
> http://yahoo.shaadi.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.375 / Virus Database: 267.15.4/255 - Release Date: 2/9/2006
>
>
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.4/255 - Release Date: 2/9/2006
Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta dirigido; contiene
informacion estrictamente confidencial y legalmente protegida, cuya divulgacion es sancionada por la
ley. Si el lector de este mensaje no es a quien esta dirigido, ni se trata del empleado o agente
responsable de esta informacion, se le notifica por medio del presente, que su reproduccion y
distribucion, esta estrictamente prohibida. Si Usted recibio este comunicado por error, favor de
notificarlo inmediatamente al remitente y destruir el mensaje. Todas las opiniones contenidas en
este mail son propias del autor del mensaje y no necesariamente coinciden con las de Radiomovil
Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, afiliadas y subsidiarias.
Este mensaje intencionalmente no contiene acentos.
This message is for the sole use of the person or entity to whom it is being sent. Therefore, it
contains strictly confidential and legally protected material whose disclosure is subject to penalty
by law. If the person reading this message is not the one to whom it is being sent and/or is not an
employee or the responsible agent for this information, this person is herein notified that any
unauthorized dissemination, distribution or copying of the materials included in this facsimile is
strictly prohibited. If you received this document by mistake please notify immediately to the
subscriber and destroy the message. Any opinions contained in this e-mail are those of the author of
the message and do not necessarily coincide with those of Radiomovil Dipsa, S.A. de C.V. or any of
its control, controlled, affiliates and subsidiaries companies. No part of this message or
attachments may be used or reproduced in any manner whatsoever.