title: How i can earn variable from string in PHP?
body: <p>I have a <code>$string = &quot;domain.com/path?query=test&quot;;</code></p>
  <p>I need to get of it 2 variables: <code>&quot;domain.com&quot; and &quot;path?query=test&quot;</code></p>
  <p>And then i need transform this variables to looks like this <code>&quot;domain.com/api/path-2?query=test-2&quot;</code></p>
  <p>How must this code looks likes? And it means i need to use <code>function</code>?</p>
  <p>Thanks you!</p>