hi all
i am building something using classes and i need to create an array of objects, i have no problems doing this but the problem comes in when i try to make a counter variable to keep track of how many objects i have of this type.
i want to put the :
$counter += 1;
into my constructor function (i think this would be the best place to put it) my problem comes in with declaring the $counter variable as global, i declare all my private / class variables like this :
var $var_01;
var $var_02;
var $var_03;
var $var_04;
var $var_05;
var $var_06;
//the problem comes in here when i declare my $counter variable
global $counter;
//once i do this the pages instantiating objects of type class A dont run and as soon as i comment this out they work again.
😕 :bemused: :glare: 😕
is it a setting in the php.ini file that i need to change or am i declaring the variable as the wrong "access type"
any help will be greatly appreciated.