Q:

Get content between 2 words

I wanna get the contents (text) between two words(word1 and word2), for example : 
word1blablabla Poetry can be divided into several genres, or categories. word2 blablabla
so the contents = blablabla Poetry can be divided into several genres, or categories.
but, the problems sometimes the word1 and word2 can be in upper-case letter or in lower-case letter. And the other problem is the word1 still be printed in the result. It should be printed. How to handle that problem? thank you :)
here's the code :
$file = 'word1 blablabla word1 Poetry can be divided into several genres, or categories. word2 blablabla ';
$word1='word1';
$word2='word2';
$between  = substr($file, strpos($file, $word1), strpos($file, $word2) - strpos($file, $word1));

A:

You can use stripos instead of strpos:

stripos — Find the position of the first occurrence of a
  case-insensitive substring in a string

