I want to check if a part of a string (not the full-string, as it will be variable) is present in an array.
$test = array(
0 => 'my searcg',
1 => 'set-cookie: shdugdd',
2 => 'viable: dunno'
);
What i want is check if either of the keys has the string "set-cookie" and if so, return the key. I can't check for full string as the set-cookie value will differ every time. It might not be present as well, so need to check that as well.
I know i can loop through the array and check the same and get the results, but am looking for a more concise/efficient answer. Having trouble getting a solution.
forstatement, thestrposcheck and a closing bracket. How more concise could it be? :)loop through the array and check the same and get the results?in_array, with strpos'ing.