I'm working on a little calculation script at the moment and for reasons I won't go into I've come across what I think might be a bit of a design faux pas.
I have an associative array which is along the lines of
The array keys are used when outputting a table of charges
I was concerned over the use of spaces but everything seems to work fine.
Now, I need to do some more work and allow for the use of discount codes. This is not a problem except that I have added a bit of HTML to the output of the array key.
Again, this works fine.
However, there comes a point where this data may be stored in a database table that is set up to store each charge in a row with columns holding the key and the value.
Retrieving these charges and displaying the result is fine but I am concerned that the key value with the HTML is going to end up being used as an array key.
My suspicion is that having the HTML in the array key is really going to mess it up.
After all that (had to get it straight in my head) I think my question is, wait for it...
Are there restrictions on what characters can be used for array keys or on their length?
--
Tek-Tips Forums is Member Supported. Click Here to donate
<honk>*:O)</honk>
Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
I have an associative array which is along the lines of
Code:
['Our Fees']=>350,
['Registry fees'=>60,
['Search fee']=>30
The array keys are used when outputting a table of charges
I was concerned over the use of spaces but everything seems to work fine.
Now, I need to do some more work and allow for the use of discount codes. This is not a problem except that I have added a bit of HTML to the output of the array key.
Again, this works fine.
However, there comes a point where this data may be stored in a database table that is set up to store each charge in a row with columns holding the key and the value.
Retrieving these charges and displaying the result is fine but I am concerned that the key value with the HTML is going to end up being used as an array key.
My suspicion is that having the HTML in the array key is really going to mess it up.
After all that (had to get it straight in my head) I think my question is, wait for it...
Are there restrictions on what characters can be used for array keys or on their length?
--
Tek-Tips Forums is Member Supported. Click Here to donate
<honk>*:O)</honk>
Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.