U
U
urfinjazz2016-03-18 12:37:34
MySQL
urfinjazz, 2016-03-18 12:37:34

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

3 answer(s)
D
Dmitry, 2016-03-18
@urfinjazz

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.

A
Andrey, 2016-03-18
@VladimirAndreev

class Property {
public $name;
public $value;
}

A
Alexander, 2016-03-18
@aspetek

Yes, php, in general, don't care what language the array key is in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question