start_session(); //to be called once, to load the $_SESSION variables.
$array = IsSet($_SESSION['array'])? $_SESSION['array']:
createArray(); //load array from session if there is any, otherwise
create a new array

function createArray()
{
   return array('1','2');
}


On May 10, 11:50 am, خليل بولو  <[email protected]> wrote:
> ÇáÊÑÌãÉ Çáì ÇáÚÑÈíÉ
>
> 2010/5/4 Muhammad Saifullah <[email protected]>:
>
>
>
>
>
> > i have some problem noticed below.
>
> > i need to load data as array to memory in PHP.but in PHP if i write $array=
> > array("1","2"); in test.php then this $array variable is initialized every
> > time user requests.if we request test.php 100 times by clicking 100 times
> > browser refresh button then this $array variable will be executed 100 times.
>
> > but i need to execute the $array variable only one time for first time
> > request and subsequent request of test.php must not execute the $array
> > variable.but only use that memory location.how can i do that in PHP.
>
> > but in JAVA SEVRVLET it is easy to execute,just write the $array variable in
> > one time execution of init() method of servlet lifecycle method and
> > subsequent request of that servlet dont execute init() method but service()
> > method but service() method always uses that $array memeory location.
>
> > all i want to initilize $array variable once but use that memory loc from
> > subsequent request in PHP.is there any possiblity in PHP?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.
>
> áÞÏ áÇÍÙÊ ÈÚÖ ÇáãÔÇßá ÃÏäÇå.
>
> ÇäÇ ÈÍÇÌÉ áÊÍãíá ÇáÈíÇäÇÊ Åáì ÇáÐÇßÑÉ æãÌãæÚÉ Ýí PHP.but Ýí Èí áæ ßäÊ
> ÃßÊÈ $ ãÌãæÚÉ ÕÝíÝ = ("1" ¡ "2") º Ýí test.php Ëã åÐÇ ÇáãÊÛíÑ ÇáÕÝíÝ $
> ÊÊã ÊåíÆÉ ßá requests.if ÇáãÓÊÎÏã ÇáæÞÊ æäÍä ØáÈ test.php 100 ãÑÉ Úä
> ØÑíÞ ÇáäÞÑ 100 ãÑÉ ÒÑ ÊÍÏíË ÇáãÊÕÝÍ Ëã ÓíÊã ÊäÝíÐ åÐÇ ÇáãÊÛíÑ ãÌãæÚÉ
> 100 ÏæáÇÑ ãÑÉ.
> æáßä ÇäÇ ÈÍÇÌÉ Çáì ÊäÝíÐ ãÌãæÚÉ ãÊÛíÑ $ ãÑÉ æÇÍÏÉ ÝÞØ áØáÈ Ãæá ãÑÉ ¡
> æØáÈ áÇÍÞ ãä test.php íÌÈ Ãä íÊã ÊäÝíÐ ãÌãæÚÉ variable.but ÏæáÇÑÇ ÝÞØ
> ÇÓÊÎÏÇã åÐå ÇáÐÇßÑÉ location.how ÃÓÊØíÚ Ãä ÃÝÚá Ðáß Ýí Èí.
> æáßä Ýí SEVRVLET ÌÇÝÇ Ýãä ÇáÓåá áÊäÝíÐ æÇáßÊÇÈÉ ÝÞØ ãÊÛíÑ ÇáÕÝíÝ ÏæáÇÑ
> Ýí æÞÊ æÇÍÏ ãä ÊäÝíÐ ÇáÍÑÝ ÇáÃæá () ØÑíÞÉ ØÑíÞÉ ÏæÑÉ ÍíÇÉ ÈÑíãÌ æØáÈ
> áÇÍÞ ãä Ðáß áÇ ÈÑíãÌ ÊäÝíÐ ÇáÍÑÝ ÇáÃæá () æáßä ØÑíÞÉ ÎÏãÉ ÇáÃÓáæÈ ()
> æáßä (ÇáÎÏãíÉ) ÇáÃÓáæÈ íÓÊÎÏã ÏÇÆãÇ Ãä ãÌãæÚÉ $ ãæÞÚ memeory.
> ßá ãÇ ÃÑíÏ initilize $ ÕÝíÝ ãÊÛíÑ ãÑÉ æÇÍÏÉ æáßä ÇÓÊÎÏÇã åÐÇ ÇáãæÖÚ
> ÇáÐÇßÑÉ ãä ØáÈ áÇÍÞ Ýí PHP.is åäÇß Ãí ÇãßÇäíÉ Ýí Èí¿
> --
>
> --www.abuawad.com
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group 
> athttp://groups.google.com/group/google-web-toolkit?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to