Answer the question
In order to leave comments, you need to log in
How to find an element in an array?
Tell me, please, there are two arrays:
The main array, where the values are needed from:
[0] => Подключения
[1] => Эксплуатация
[2] => Эксплуатация
[3] => Подключения
[4] => Эксплуатация
[5] => Подключения
[6] => Подключения
[7] => Подключения
и т.д.
[0] => 0
[1] => 3
[2] => 5
[3] => 6
[4] => 7
[5] => 8
[6] => 9
[7] => 10
и т.д.
Answer the question
In order to leave comments, you need to log in
We look at the list Functions for working with arrays
It looks like this one will do:
$a = [
0 => 'Подключения',
1 => 'Эксплуатация',
2 => 'Эксплуатация',
3 => 'Подключения',
4 => 'Эксплуатация',
5 => 'Подключения',
6 => 'Подключения',
7 => 'Подключения',
];
$b = [
0 => 0,
1 => 3,
2 => 5,
3 => 6,
4 => 7,
5 => 8,
6 => 9,
7 => 10,
];
$c = array_combine($b, $a);
echo $c[7]; // Эксплуатация
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question