{"id":108,"date":"2012-07-20T15:12:11","date_gmt":"2012-07-20T15:12:11","guid":{"rendered":"http:\/\/codeatelier.wordpress.com\/?p=108"},"modified":"2012-07-20T15:12:11","modified_gmt":"2012-07-20T15:12:11","slug":"working-with-arrays","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/working-with-arrays\/","title":{"rendered":"Working With Arrays"},"content":{"rendered":"<p><strong>How to Convert an Multidimensional Array to One Dimensional Array<\/strong><br \/>\n\/\/First Method with No Argument<\/p>\n<pre>\n$this-&gt;RestructArray($arrTempCounts)\n\n\/\/Second Method with  Column Name as Argument\n$this-&gt;RestructArray($arrTemp, 'UserNums');\n\nfunction RestructArray($parrInput, $pArg1 = 0)\n{\n\t$arrTemp = $parrInput;\n\t\n\tfor($i=0;$i&lt;count($parrInput);$i++)\n\t{\n\t\t$arrNames[$i] = $parrInput[$i][$pArg1];\n\t}\n\treturn $arrNames;\n}\n\n<\/pre>\n<p><strong>How to Convert an One Dimensional Array to Multidimensional Array<\/strong><\/p>\n<pre>\n$k = 0;\nfor($j=0;$j&lt;$lngCols;$j++)\n{\n\tfor($i=0;$i&lt;$lngRows-1;$i++)\n\t{\t\t\n\t\t$arrTemp[$j][$i] = $arrIndividualCounts[$k];\n\t\t$k = $k+1;\n\t}\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>How to Convert an Multidimensional Array to One Dimensional Array \/\/First Method with No Argument $this-&gt;RestructArray($arrTempCounts) \/\/Second Method with Column Name as Argument $this-&gt;RestructArray($arrTemp, &#8216;UserNums&#8217;); function RestructArray($parrInput, $pArg1 = 0) { $arrTemp = $parrInput; for($i=0;$i&lt;count($parrInput);$i++) { $arrNames[$i] = $parrInput[$i][$pArg1]; } return $arrNames; } How to Convert an One Dimensional Array to Multidimensional Array $k =&hellip; <a href=\"https:\/\/codethataint.com\/blog\/working-with-arrays\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[93],"tags":[],"class_list":["post-108","post","type-post","status-publish","format-standard","hentry","category-php"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=108"}],"version-history":[{"count":0,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/108\/revisions"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}