Click here to Skip to main content
15,889,266 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I am very new to php..I need your help

I have to files: A,B
in A:

class A
public $var;
//
function...{
static $var=0; (as I want to change and keep the value)
if.... $var+=1;

}
?>
in other file I have Class B
Class B
//
function...{
include(A.class.php)
$var2=new A
if $var2->var1==0  .....


But the problem is it always return null...I want the last value in class A...But that doesnt work....Please help me on this
I cant figure it out!!!


Regards
Posted
Updated 24-Jun-10 21:20pm
v3
Comments
GPUToaster™ 29-Jun-10 2:14am    
what is "var1"? is it var or var1? Just check what you have asked.

1 solution

keep your static variable in the php global array $_GLOBAL and now you can assess it where you want.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900