I am relatively new to PHP. I have declared a class to hold some configuration information for my site. In this class i want to declare an associative array of paths. If I declare it thus:
[CODE]var $Paths = array
(
"HTML" => "HTML/",
"NEWSIMAGES" => "HTML/Images/News/",
"BRANDLOGOS" => "HTML/Images/BrandLogos/",
"PRODUCTIMAGES" => "HTML/Images/Products/",
"PRODUCTDOCUMENTS" => "HTML/Documents/Products/"
);[/CODE]
all seems OK
But I thought i would be able to declare it as follows:
$Paths = array();
$Paths["HTML"] = "HTML/";
$Paths["NEWSIMAGES"] = "HTML/Images/News";
However when I run this I get an error:
Parse error: parse error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in . . . .
I thought both methods of declaring the array were equally valid. Or is the problem that I am declaring it within a class?
Help please I am terribly confused.
Thanks
Z