title: preg_match_all is not giving desired result
body: <p>I have a HTML content like this one</p>
  
  <pre><code>some html text [link id="1"]  some html text 
  some html text [link id="2"]  some html text 
  some html text [link id="3" stat="y"]  some html text 
  some html text [link id="4" stat="y"]  some html text 
  </code></pre>
  
  <p>I'm using </p>
  
  <p><code>var_dump(preg_match_all('/\[link([^\[]+)\]/',$html_tags, $result));</code> </p>
  
  <p>to extract <code>[link]</code> tags from it and it is giving me an <code>array</code> like this </p>
  
  <pre><code>array(2) {
    [0]=&gt; array(4) {
      [0]=&gt; string(13) "[link id="1"]"
      [1]=&gt; string(13) "[link id="2"]"
      [2]=&gt; string(21) "[link id="3" stat="y"]"
      [3]=&gt; string(21) "[link id="4" stat="y"]"
    }
    [1]=&gt; array(4) {
      [0]=&gt; string(7) " id="1""
      [1]=&gt; string(7) " id="2""
      [2]=&gt; string(15) " id="3" stat="y""
      [3]=&gt; string(15) " id="4" stat="y""
    }
  }
  </code></pre>
  
  <p>Can anyone please tell me how I can get the result like this</p>
  
  <pre><code>array (1){
      [0]=&gt; array (4) {
          [0] =&gt; array (2){
              [id]  =&gt; string(1) "1"
              [stat] =&gt; string(0) ""
          }
          [1] =&gt; array (2){
              [id]  =&gt; string(1) "2"
              [stat] =&gt; string(0) ""
          }
          [2] =&gt; array (2){
              [id]  =&gt; string(1) "3"
              [stat] =&gt; string(1) "y"
          }   
          [3] =&gt; array (2){
              [id]  =&gt; string(1) "4"
              [stat] =&gt; string(1) "y"
          }   
      }
  }
  </code></pre>