Is it possible to check if an array contains key with "Path" word in it and return its value without using a foreach loop?
For example here I want to have the value2 returned:
$array = [];
$array['abc'] = "value1";
$array['abc_Path'] = "value2";
Is it possible to check if an array contains key with "Path" word in it and return its value without using a foreach loop?
For example here I want to have the value2 returned:
$array = [];
$array['abc'] = "value1";
$array['abc_Path'] = "value2";
<?php
$array = array(0 => 'blue', 1 => 'red', 2 => 'green', 3 => 'red');
$key = array_search('green', $array); // $key = 2;
$key = array_search('red', $array); // $key = 1;
Or use array_map with your own function to figure out.