title: Get the string between "[img]XXXXX[/img]" tags PHP
body: <p>Hi i have a problem I don't now how get a string between the [img] [/img] tag</p>
  
  <p>For example:</p>
  
  <pre><code>$string = "Hello i am new [img]nice_photo[/img] so here is my avatar [img]avatar[/img] ok its all";
  </code></pre>
  
  <p>I will get the string "avatar" and "nice_photo"</p>
  
  <p>Please help thanks.</p>
  
  <p>Edit:
  Hmm I give a example what will make I have a string for example:
   <code>$s = "Hello [img] nice [img]https://imgur.com/ddd.jpg/[/img] this is a photo"</code></p>
  
  <p>And I have a array of permitted domains:</p>
  
  <pre><code>$domains = array("Imgur.com", "iv.com");
  </code></pre>
  
  <p>I will check the domain between the [img] [/img] If the domain between the tags is in the array $domains then is ok
   If the domain between the tags isn't in the array the string will be change to:</p>
  
  <pre><code>$s_new = "Hello [img] nice [img]***[/img] this is a photo"
  </code></pre>