 <blockquote> <p>The first parameter contains the name of the view file (in this example the file would be called blog_template.php), and the second parameter contains an associative array of data to be replaced in the template.</p> </blockquote> <pre><code>$data = array( 'blog_title' =&gt; 'My Blog Title', 'blog_heading' =&gt; 'My Blog Heading', 'blog_entries' =&gt; array( array('0' =&gt; 'Title 1', 'body' =&gt; 'Body 1'), array('1' =&gt; 'Title 2', 'body' =&gt; 'Body 2'), array('2' =&gt; 'Title 3', 'body' =&gt; 'Body 3'), array('3' =&gt; 'Title 4', 'body' =&gt; 'Body 4'), array('4' =&gt; 'Title 5', 'body' =&gt; 'Body 5') )); foreach ($data['blog_entries'] as &amp;$arr) { foreach ($arr as $k =&gt; $v) { if (is_numeric($k)) { $arr['title'] = $v; unset($arr[$k]); } } $arr = array_reverse($arr); } echo '&lt;pre&gt;', var_dump($data);exit; </code></pre> <p>But you should be aware of eventual changes of structure of <code>$data</code> array. So if your api would export one more element with numeric key to that array, this code would be broken probably. You can check and test it though.</p>