Arrays and classes.
Posted: Tue Dec 09, 2003 9:12 pm
Hi,
I'm having troubles with creating an array within a class. There's no problem doing it elsewhere, it's just inside a class.
I start off by making the class
I then declare a few variables,
I then have a function, which then creates an array, and echos it.
Then of course, I end the class.
Nothing happens when I call the function within the class. I've verified i'm calling the function correctly by adding
to the function.
If anyone can point out what i'm doing wrong, it'd be greatly appreciated.
I've checked the manual, google'd it -> What am I missing???
Thanks.
I'm having troubles with creating an array within a class. There's no problem doing it elsewhere, it's just inside a class.
I start off by making the class
Code: Select all
class Name {I then declare a few variables,
Code: Select all
var $something;Code: Select all
function name() {
$this->array = array(1 => 'a','b','c');
echo $this->array[1];
}Code: Select all
}Code: Select all
echo "test";If anyone can point out what i'm doing wrong, it'd be greatly appreciated.
I've checked the manual, google'd it -> What am I missing???
Thanks.