I have tried to filter the string from the array which consists of the word DEVICE.
I have used the following technique to check whether there is a word called having DEVICE in the array but it prints
Match Not found
even though there are strings having word DEVICE.
Here is the attempt that I have tried:
$output= array('football GAME', 'cricket GAME', 'computer DEVICE','mobile DEVICE');
$string = 'DEVICE';
foreach ($output as $out) {
if (strpos($string, $out) !== FALSE) {
echo "Match found";
return true;
}
}
echo "Match Not found!";
return false;
Required Output:
The output should be:
Match Found.
And also I want to display the list of the items that consist of the word DEVICE like:
computer DEVICE
mobile DEVICE
What correction do I need here?
strposarguments back-to-front. It'sstrpos(string $haystack, string $needle)