title: wordpress show unserialize data in a smart way
body: <p>In wordpress I have stored the data in database as serialize method. Now I have fetched the data in an array. So the code is like this</p>
  
  <pre><code>global $wpdb;
   $results = wpdb-&gt;get_results("SELECT * FROM `table` where `id` = 3");
   foreach($results as $result) {
      echo '&lt;pre&gt;';
          print_r($result);
      echo '&lt;/pre&gt;';
   }
  </code></pre>
  
  <p>This one is getting me data like this</p>
  
  <pre><code>Array
  (
      [0] =&gt; stdClass Object
          (
              [id] =&gt; 1
              [title] =&gt; a:3:{i:1;s:8:"test1";i:2;s:8:"test2";i:0;s:0:"test3";}
              [page] =&gt; a:3:{i:1;s:3:"dsa";i:2;s:4:"dsds";i:0;s:0:"sdvdsvds";}
          )
  
  )
  </code></pre>
  
  <p>Now I want to count the values and want to show all the values in listing. Here you can see I have 3 values for title and page. So I took title as counter. So I made like this</p>
  
  <pre><code>foreach($results as $result) {
      $count = count(unserialize($result-&gt;title)); // This gave 3
      for( $i = 0; $i&lt;$count; $i++ ) {
          echo '&lt;li&gt;&lt;/li&gt;'; // This gave me 3 li's that I wanted
      }
   }
  </code></pre>
  
  <p>Now to get all the values for title and page I need again foreach and unserialize method. So can someone kindly tell me what is the nice and smart way to show the data for title and words here(inside li's). Any suggestions and help will be really appreciable.</p>