I have the following code
$string="red and blue are primary colors";
$colors=array('red','green','blue');
$colorvalue=array();
I want to acheive the following.
1. Search the $string to find any occurrence of the values in the $colors array
2. when a match is found populate the $colorvalue array with the color key.
So using the above example I would have the following result
$colorvalue=array(0,2);
Any help really appreciated.