title: find the multiple occurrence of a word in a string using regular expression in php
body: <p>I am trying to find the multiple occurrence of a string and also need to find the string after the word which is matched.
  I will explain you clearly.</p>
  
  <p><code>First  :</code></p>
  
  <pre><code>$string  = "Apple = A fruit which keeps u healthy\n Ball = Used to play games  \nApple = A fsadasdasdit wasdashich keeps u healthy\n";
  $keyword = "apple";
  $pattern = '/^.*?\b'.$keyword.'\b.*/i';
  $res = preg_match_all($pattern , $string , $matches);
  print_r($matches);
  </code></pre>
  
  <p>Here, I am trying to find the occurrence of apple in the string. But, it is showing only the first word apple. but it is not showing the second word.</p>
  
  <p><code>Second :</code> If I found all the words which matches the keyword. I need the string after the word.
  That means, 
  Here, Apple matches two times</p>
  
  <p>first time if the keyword matched, I will get this <code>Apple = A fruit which keeps u healthy</code> . 
  Now, I need to store <code>A fruit which keeps u healthy</code> in one variable.</p>
  
  <p>second time again the apple matched here, I will get <code>Apple = A fsadasdasdit wasdashich keeps u healthy\n</code> and I need to store <code>A fsadasdasdit wasdashich keeps u healthy</code> in another variable. </p>
  
  <p>Please help me in doing this. Thanks in advance!</p>