在数组中查找类似条件

Int*_*han 3 php mysql arrays sorting

我有以下数组,我想使用搜索和排序.搜索和排序就像排序我们用MySQL"LIKE"条件,但数组不在数据库中.

Array
(
    [4] => Varun Kumar
    [14] => Jason Ince
)
Run Code Online (Sandbox Code Playgroud)

就像在键入'jas'时,Jason Ince的记录必须分别用键和值以及记录的其余部分来表示.

Sud*_*oti 8

你的意思是:

foreach($yourArr as $key => $value) {
    if (strpos($value, $yourString) !== false) {
       //results here
    }
}
Run Code Online (Sandbox Code Playgroud)