{"id":680,"date":"2013-01-04T06:53:03","date_gmt":"2013-01-04T06:53:03","guid":{"rendered":"http:\/\/codeatelier.wordpress.com\/?p=438"},"modified":"2013-01-04T06:53:03","modified_gmt":"2013-01-04T06:53:03","slug":"how-to-sort-array-by-inner-array-php","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/how-to-sort-array-by-inner-array-php\/","title":{"rendered":"how to sort array by inner array php"},"content":{"rendered":"<pre>\n $arrSam1[0] = array(\"a\", array(\"2\"));\n $arrSam1[1] = array(\"b\", array(\"1\",\"2\", \"3\", \"4\"));\n $arrSam1[2] = array(\"c\", array(\"1\",\"2\", \"3\"));\n \n $arrSam = usort($arrSam1, 'cmp');\n\n function cmp($a, $b)\n {\n   return count($a[1]) &gt; count($b[1]) ? -1 : 1;\n }\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>$arrSam1[0] = array(&#8220;a&#8221;, array(&#8220;2&#8221;)); $arrSam1[1] = array(&#8220;b&#8221;, array(&#8220;1&#8243;,&#8221;2&#8221;, &#8220;3&#8221;, &#8220;4&#8221;)); $arrSam1[2] = array(&#8220;c&#8221;, array(&#8220;1&#8243;,&#8221;2&#8221;, &#8220;3&#8221;)); $arrSam = usort($arrSam1, &#8216;cmp&#8217;); function cmp($a, $b) { return count($a[1]) &gt; count($b[1]) ? -1 : 1; }<\/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-680","post","type-post","status-publish","format-standard","hentry","category-php"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/680","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=680"}],"version-history":[{"count":0,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/680\/revisions"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=680"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}