I'm currently using PHP Stripos OK to look for a word (parrots) is present within a URL.
However I now need to check that 2 words (green and parrots) are present in a URL, i.e. they must both be present.
Here's the current code:
if (stripos($_SERVER['REQUEST_URI'],'-parrots') !== false)
{echo '<div class="clear"></div><a href="http://www.example.com/parrots/" class="btn"> >> Parrots</a>';}
The above works well.
For two words I've tried:
if (stripos($_SERVER['REQUEST_URI'],'-green','-parrots') !== false)
{echo '<div class="clear"></div><a href="http://www.example.com/green-parrots/" class="btn"> >> Green Parrots</a>';}
But that doesn't seem to work.
Any ideas?
Just use two
stripos
calls: