{"id":848,"date":"2024-12-10T03:24:13","date_gmt":"2024-12-10T03:24:13","guid":{"rendered":"https:\/\/monkey.ploogie.co.uk\/?page_id=848"},"modified":"2024-12-10T03:40:30","modified_gmt":"2024-12-10T03:40:30","slug":"mwnci-ucount-function","status":"publish","type":"page","link":"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-ucount-function\/","title":{"rendered":"Mwnci ucount() Function"},"content":{"rendered":"<h2>Syntax<\/h2>\n<p>ucount<strong>(<em>array<\/em>)<\/strong><\/p>\n<h2>Description<\/h2>\n<p>The <i>ucount()<\/i> function returns a hash containing the array elements as the key, and a count of how many times the key is present in the array<\/p>\n<h2>Example<\/h2>\n<pre>\r\na=[1,2,3,1,2,3,4,5,6,100]\r\nprintln(ucount(a))\r\nb=[\"eccles\", \"eccles\", \"neddie\", \"bluebottle\", \"bluebottle\", \"moriarty\"]\r\nprintln(ucount(b))\r\n\r\n\r\n{\"2\": 2, \"3\": 2, \"4\": 1, \"5\": 1, \"6\": 1, \"100\": 1, \"1\": 2}\r\n{\"neddie\": 1, \"bluebottle\": 2, \"moriarty\": 1, \"eccles\": 2}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Syntax ucount(array) Description The ucount() function returns a hash containing the array elements as the key, and a count of how many times the key is present in the array Example a=[1,2,3,1,2,3,4,5,6,100] println(ucount(a)) b=[&#8220;eccles&#8221;, &#8220;eccles&#8221;, &#8220;neddie&#8221;, &#8220;bluebottle&#8221;, &#8220;bluebottle&#8221;, &#8220;moriarty&#8221;] println(ucount(b)) {&#8220;2&#8221;: 2, &#8220;3&#8221;: 2, &#8220;4&#8221;: 1, &#8220;5&#8221;: 1, &#8220;6&#8221;: 1, &#8220;100&#8221;: 1, &#8220;1&#8221;: 2} {&#8220;neddie&#8221;: &hellip; <a href=\"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-ucount-function\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Mwnci ucount() Function&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-848","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/848","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=848"}],"version-history":[{"count":4,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/848\/revisions"}],"predecessor-version":[{"id":850,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/848\/revisions\/850"}],"wp:attachment":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}