V
V
Vasya Surname2015-05-06 12:08:46
PHP
Vasya Surname, 2015-05-06 12:08:46

How to find key of similar value in array?

Array
(
    [0] => Солнечный остров
    [1] => Дом у Речного вокзала
    [2] => Медовая поляна
    [3] => Чистый ручей
)

For example, find by the word "House" the key where this word occurs in the value
. In this case, it is "1"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Mokhov, 2015-05-06
@bazilio2010

$input = ['входящий массив', 'например ваш'];
$output = array_filter($input, function ($str) {return false !== stripos($str, 'например');});
print_r($output);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question