help me please!
I have a table in a database
Cars
====
1
2
3
4
4
2
3
1
4
2
===
I have a static array
cars =
[
1 => 'BMW',
2 => 'Honda',
3 => 'Toyota',
4 => 'Mazda',
]
How can I change data from a table to data from a static array when displaying data?
I tried
private $car;
protected const cars = [
1 => 'BMW',
2 => 'Honda',
3 => 'Toyota',
4 => 'Mazda',
];
public static function getCars() {
return self::cars;
}
public static function getCarCaption($car) {
return self::cars[$car];
}