{"id":350,"date":"2018-01-11T15:27:31","date_gmt":"2018-01-11T15:27:31","guid":{"rendered":"http:\/\/mddir.com\/how-to\/?p=350"},"modified":"2018-01-11T15:28:31","modified_gmt":"2018-01-11T15:28:31","slug":"multidimensional-arrays","status":"publish","type":"post","link":"https:\/\/www.mddir.com\/how-to\/multidimensional-arrays\/","title":{"rendered":"Multidimensional Arrays"},"content":{"rendered":"<p>A Multidimensional Arrays is used when you want to store data on more than one or more arrays.<br \/>\n<strong><br \/>\nExample:<\/strong><\/p>\n<p>[php]&lt;?php<br \/>\n$cars = array<br \/>\n  (<br \/>\n  array(&quot;Volvo&quot;,22,18),<br \/>\n  array(&quot;BMW&quot;,15,13),<br \/>\n  array(&quot;Saab&quot;,5,2),<br \/>\n  array(&quot;Land Rover&quot;,17,15)<br \/>\n  );<\/p>\n<p>echo $cars[0][0].&quot;: In stock: &quot;.$cars[0][1].&quot;, sold: &quot;.$cars[0][2].&quot;.&lt;br&gt;&quot;;<br \/>\necho $cars[1][0].&quot;: In stock: &quot;.$cars[1][1].&quot;, sold: &quot;.$cars[1][2].&quot;.&lt;br&gt;&quot;;<br \/>\necho $cars[2][0].&quot;: In stock: &quot;.$cars[2][1].&quot;, sold: &quot;.$cars[2][2].&quot;.&lt;br&gt;&quot;;<br \/>\necho $cars[3][0].&quot;: In stock: &quot;.$cars[3][1].&quot;, sold: &quot;.$cars[3][2].&quot;.&lt;br&gt;&quot;;<br \/>\n?&gt;[\/php]<\/p>\n<p><strong>Code explaination:<\/strong><\/p>\n<p>In the above code, we have mentioned Multidimensional Arrays. There are total 4 arrays we are using to get the data.<\/p>\n<p>The echo statement is used to present the data using the structured array format. It is majorly used in presenting the data in the table format.<\/p>\n<p>Above code will generate the following result<br \/>\n<code><br \/>\nVolvo: In stock: 22, sold: 18.<br \/>\nBMW: In stock: 15, sold: 13.<br \/>\nSaab: In stock: 5, sold: 2.<br \/>\nLand Rover: In stock: 17, sold: 15.<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A Multidimensional Arrays is used when you want to store data on more than one or more arrays. Example: [php]&lt;?php $cars = array ( array(&quot;Volvo&quot;,22,18),<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-350","post","type-post","status-publish","format-standard","hentry","category-php"],"_links":{"self":[{"href":"https:\/\/www.mddir.com\/how-to\/wp-json\/wp\/v2\/posts\/350","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mddir.com\/how-to\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mddir.com\/how-to\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mddir.com\/how-to\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mddir.com\/how-to\/wp-json\/wp\/v2\/comments?post=350"}],"version-history":[{"count":2,"href":"https:\/\/www.mddir.com\/how-to\/wp-json\/wp\/v2\/posts\/350\/revisions"}],"predecessor-version":[{"id":352,"href":"https:\/\/www.mddir.com\/how-to\/wp-json\/wp\/v2\/posts\/350\/revisions\/352"}],"wp:attachment":[{"href":"https:\/\/www.mddir.com\/how-to\/wp-json\/wp\/v2\/media?parent=350"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mddir.com\/how-to\/wp-json\/wp\/v2\/categories?post=350"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mddir.com\/how-to\/wp-json\/wp\/v2\/tags?post=350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}