title: php replace some strings between tags or chars
body: <p>I need to replace some text in a string. I think an example can explain better:</p>
  
  <p>[myFile.json]</p>
  
  <pre><code>{ "Dear":"newString1", "an example string":"newString2" }
  </code></pre>
  
  <p>[example.php]</p>
  
  <pre><code>$myString = "@Dear@ name, this is @an example string@.";
  
  function gimmeNewVal($myVal){
      $obj = json_decode(file_get_contents('myFile.json'));
      return $obj-&gt;$myVal;
  }
  
  echo gimmeNewVal("Dear"); // This print "newString1"
  </code></pre>
  
  <p>So, what I need is to find any strings between the '@' symbol and for each string found I need to replace using the gimmeNewVal() function.</p>
  
  <p>I already tried with preg_* functions but I'm not very able with regex...</p>
  
  <p>Thanks for your help</p>