Re: Why Can't I "define" a Value for a Subscript? [message #175240 is a reply to message #175235] |
Sun, 28 August 2011 20:02 |
Peter H. Coffin
Messages: 245 Registered: September 2010
Karma:
|
Senior Member |
|
|
On Sun, 28 Aug 2011 15:18:32 -0400, eBob.com wrote:
> I am working with some csv files. To make the program more maintainable and
> more self-documenting I "define" values to use as subscripts; e.g. ...
>
> define('SS2KEY',0);
>
> BUT, whereas this produces what I expected ...
>
> echo "we have a match - key: $file2cols[0]\n";
>
> ... this does not ...
>
> echo "we have a match - key: $file2cols[SS2KEY]\n";
>
> I see the other text but no value is substitited for $file2cols[SS2KEY]
>
> I've wasted so much time on this. Why can't I define constants to use as
> subscripts?
Try the following right after the failing example:
print "This is a quoted constant: SS2KEY\n";
$foo=$file2cols[SS2KEY];
print "this is a variable assigned: $foo\n";
print "this is concat test: ".$file2cols[SS2KEY]."\n";
Then come back and tell us if you want to change your question.
--
I still want a phone with caller-IQ.
-- Tanuki in the monastery
|
|
|