title: How to parse data from a big string using php?
body: <p>i got a big string as shown below(number of sets of data is not known):</p>
  
  <pre><code>  p '5123': {
              p 'tmp': p '1', p 'name': p 'mango', p 'abc': p 'abcd4 http://mysite/items/1234', p 'number': p '1123', p 'itemCategory_title': p 'fruits', p 'logo': p '2123.png', p 'itemCategory_id': p '90'
          }, p '700': {
              p 'tmp': p '0', p 'name': p 'cherry', p 'abc': p 'abcd4 http://mysite/items/1235', p 'number': p '1124', p 'itemCategory_title': p 'fruits', p 'logo': p '2124.png', p 'itemCategory_id': p '91'
          }, p '800': {
  ....................
  </code></pre>
  
  <p>i want to extract the following data from it and create a hyperlink for each set of data! (extract following values: tmp,name,abc,number,itemCategory_title,logo,itemCategory_id)</p>
  
  <p>could any one tell me how i can extract the following data ?Thanks in advance.</p>
  
  <p>sample one set of data to extract :</p>
  
  <pre><code>tmp=1
   name=mango
   abc=abcd4 http://mysite/items/1234
   number=1123
   itemCategory_title=fruits
   log=2123.png
   itemCategory_id=90
  </code></pre>
  
  <p>output this html hyperlinks via php:</p>
  
  <pre><code>&lt;a href="./process.php?tmp=1&amp;name=mango&amp;abc=abcd4 http://mysite/items/1234&amp;number=1123&amp;itemCategory_title=fruits&amp;log=2123.png&amp;itemCategory_id=90"&gt;mango &lt;/a&gt; &lt;br /&gt;
  &lt;a href="./process.php?tmp=1&amp;name=cherry&amp;abc=abcd4 http://mysite/items/1235&amp;number=1124&amp;itemCategory_title=fruits&amp;log=2124.png&amp;itemCategory_id=91"&gt;cherry &lt;/a&gt; &lt;br /&gt;
  </code></pre>
  
  <p>code2 holds the sample input string:
  
  
  <pre><code>    $code2 = stripslashes($_POST['outputtext']);
  $clean_str = str_replace("p '","'",$code2);
  
  $serialized = serialize($clean_str);
  $expected_array = unserialize($serialized);
  print_r($expected_array);
  
  
        // iterate the new array
      for($i = 0; $i &lt; count($expected_array); $i++){
      ?&gt;
      &lt;a href="./process.php?tmp=&lt;?php  echo $expected_array['tmp'] ; ?&gt;&amp;name=&lt;?php  echo $expected_array['name'] ; ?&gt;&amp;abc=&lt;?php  echo $expected_array['abc'] ; ?&gt;&amp;itemCategory_title=&lt;?php  echo $expected_array['itemCategory_title'] ; ?&gt;&amp;log=&lt;?php  echo $expected_array['log'] ; ?&gt;&amp;itemCategory_id=&lt;?php  echo $expected_array['itemCategory_id'] ; ?&gt;"&gt;&lt;?php  echo $expected_array['itemCategory_title'] ; ?&gt; &lt;/a&gt; &lt;br /&gt;
      &lt;?
      }
  </code></pre>