title: Variable in single quote
body: <p>I have a code:</p>
  
  <pre><code>$str = 'some code';
  $String = 'Some params  , This is  {$str}';
  $String = str_replace('\'', "\"", $String);
  $array = explode(',', $String);
  
  var_dump($array);
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>' This is  {$str}'
  </code></pre>
  
  <p>How can i get a string <code>' This is some code'</code> without using double quotes in <code>$String = 'Some params  , This is  {$str}';</code>? 
  Is there any function? str_replace doesn't work.</p>
  
  <p>EDIT:
  Code above is example. A special case of my code.
  I mean code like:</p>
  
  <pre><code>$str1 = 'some code 1';
  $str2 = 'some code 2';
  $str3 = 'some code 3';
  $str = '{$str1}  ...  {$str2} ... {$str3}  ';
  $result = preg_match_all('/({\$\S*})/',$str,$res);
  
  foreach ($res[0] as $value){
      $arr_replace = ['{$','}'];
      $value_replaced = str_replace($arr_replace, "",$value);
      $str = str_replace($value,$$value_replaced,$str);
  }
  var_dump($str);
  </code></pre>
  
  <p>Is there a simpler method?</p>