IT Community - Software Programming, Web Development and Technical Support

How to define a static variables in php.

This is a discussion on How to define a static variables in php. within the PHP Programming forums, part of the Web Development category; Hi all.... How to define a static variables in php? Thanks......


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > PHP Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 11-10-2007, 04:27 AM
itbarota itbarota is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 547
itbarota is on a distinguished road
Default How to define a static variables in php.

Hi all....


How to define a static variables in php?


Thanks...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-10-2007, 04:40 AM
Pvinothkumar Pvinothkumar is offline
D-Web Analyst
 
Join Date: Sep 2007
Posts: 237
Pvinothkumar is on a distinguished road
Default Re: How to define a static variables in php.

Hi all...


<?
$stat = 77;
function stvar () {
abc $stat = 0;
$a123 = array("karthik","saran","santhosh","sundar");
$stat++;
$stat %= count($a123);
return $a123[$stat];
}
for ($k=0; $k<10; $k++) {
print "What is your name - ".stvar()."?<br />";
}
print $stat;
?>

output:
What is your name - saran?
What is your name - santhosh?
What is your name - sundar?
What is your name - karthik?
What is your name - saran?
What is your name - santhosh?
What is your name - sundar?
What is your name - karthik?
What is your name - saran?
What is your name - santhosh?


Thanks...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to define a global variable in PHP? itbarota PHP Programming 3 11-01-2007 10:58 AM
Define Qos vadivelanvaidyanathan Server Management 1 07-16-2007 09:36 AM
Static Global Variable and Static Local Variable vigneshgets C and C++ Programming 1 05-30-2007 11:50 AM
difference between a static and a non-static inner class vigneshgets Java Programming 1 05-23-2007 11:02 PM
Please Define the Terms djree General Web hosting Discussions 2 03-13-2007 07:23 AM


All times are GMT -7. The time now is 04:46 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0