Добрый день ! Есть массив:
Array
(
[0] => Array
(
[Payment Identifier] => 398013C5-41DA-4665-ACCF-0C6A856E
[Payment Number] => 09334423871952077061
[Payment Account] => 17320
)
[1] => Array
(
[Payment Identifier] => 521914E5-5AC8-4CAD-A5C8-94105AD4FB08
[Payment Number] => 09697256801664001984
[Payment Account] => 21695
)
[2] => Array
(
[Payment Identifier] => C46BA74B-F90F-468E-B931
[Payment Number] => 096972568019059
[Payment Account] => 21695
)
и код к нему
function searchForId($search, $arr) {
$temp_arr = [];
foreach ($arr as $key => $val) {
if ($val['Payment Identifier'] === $search) {
array_push($temp_arr, $key);
//return $key;
}
if ($val['Payment Number'] === $search) {
array_push($temp_arr, $key);
//return $key;
}
if($val['Payment Account'] === $search) {
array_push($temp_arr, $key);
//return $key;
}
}
return $temp_arr;
}
$result = searchForId('27942', $paymentsArr);
foreach ($result as $key) {
echo "<br>";
print_r($paymentsArr[$key]);
}
Как сделать по нему поиск как в бд %like%? У меня получается искать только целиком