Answer the question
In order to leave comments, you need to log in
Should I use Cyrillic keys in an array (PHP)?
Good afternoon.
The user creates an ad, the ad can have an arbitrary number of additional fields. I created a separate table for ads, separately for ad parameters. The ad parameters table has ad_id, param, value fields. The site is Russian, the parameters will be Cyrillic. Roughly speaking param = 'color', value = 'red'.
Question! Is it worth it to do so? I don't see any other solution. I refer to the parameter like this: $param['color']. In postgre, of course, you can store the parameter in an array, but the meaning of this will not change, the array keys will remain Cyrillic.
UPD: if ($param == 'color'){} seems to me an equivalent solution, if not worse, because it clutters up the code.
Answer the question
In order to leave comments, you need to log in
Create fields in the table:
ad_id, param_name, param_title, value
For example:
param_name = color
param_title = color
value = red
Although PHP supports Cyrillic keys, it's better to be safe.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question