title: alter word keeping the punctuation mark in its own position
body: <p>I want a program in php that takes the first letter of word to the last and add "ay" at end. example:
  <code>I love my family</code> becomes <code>Iay ovelay ymay amilyfay</code></p>
  
  <p>I did this to get my result:</p>
  
  <pre><code>&lt;?php
  $var = "I love my family";
  $words = explode(" ",$var);
  $final = "";
  foreach ($words as $word){
      $n = "";
      for($i=1;$i&lt;strlen($word);$i++){
          $n .= $word{$i};
      }
      $n .= $word{0}."ay";
      $final .= $n." ";
  }
  echo $final;
  ?&gt;
  </code></pre>
  
  <p>but this doesnt work when the input is: <code>he says, "I love my family"</code>. this gives output as: <code>ehay ays,say I"ay ovelay ymay amily"fay</code> where I need the punctuation marks to be in their own position like this: <code>ehay ayssay, "Iay ovelay ymay amilyfay"</code></p>
  
  <p>Tried alot but found nothing that works</p>