RE: static variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxxxxx]
Sent: Viernes, 10 de Febrero de 2006 12:45 a.m.
To: php-general@xxxxxxxxxxxxx
Cc: suresh kumar
Subject: Re:  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@xxxxxxxxxxx>
To: <php-general@xxxxxxxxxxxxx>
Sent: Thursday, February 09, 2006 9:50 PM
Subject:  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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux