{"id":642,"date":"2024-11-18T10:45:17","date_gmt":"2024-11-18T10:45:17","guid":{"rendered":"http:\/\/monkey.ploogie.co.uk\/?page_id=642"},"modified":"2025-09-26T10:35:37","modified_gmt":"2025-09-26T09:35:37","slug":"mwnci-median-function","status":"publish","type":"page","link":"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-median-function\/","title":{"rendered":"Mwnci median() Function"},"content":{"rendered":"<h2>Syntax<\/h2>\n<p>median<strong>(<em>array<\/em>)<\/strong><\/p>\n<h2>Description<\/h2>\n<p>The <i>median()<\/i> function returns the median (middle value) of the given data set. This method also sorts the data in ascending order before calculating the median.<\/p>\n<p>If the number of data values is odd, it returns the exact middle value. If the number of data values is even, it returns the average of the two middle values.<\/p>\n<h2>Example<\/h2>\n<pre>include(\"stats\")\r\nprintln(median([1, 3, 5, 7, 9, 11, 13]))\r\nprintln(median([1, 3, 5, 7, 9, 11]))\r\nprintln(median([-11, 5.5, -3.4, 7.1, -9, 22])) \r\n\r\n\r\n7\r\n6\r\n1.05\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Syntax median(array) Description The median() function returns the median (middle value) of the given data set. This method also sorts the data in ascending order before calculating the median. If the number of data values is odd, it returns the exact middle value. If the number of data values is even, it returns the average &hellip; <a href=\"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-median-function\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Mwnci median() 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-642","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/642","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=642"}],"version-history":[{"count":3,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/642\/revisions"}],"predecessor-version":[{"id":1206,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/642\/revisions\/1206"}],"wp:attachment":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=642"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}