{"id":3301,"date":"2022-09-23T10:33:32","date_gmt":"2022-09-23T10:33:32","guid":{"rendered":"https:\/\/info.documotor.com\/?page_id=3301"},"modified":"2023-01-25T10:16:28","modified_gmt":"2023-01-25T10:16:28","slug":"distinct","status":"publish","type":"page","link":"https:\/\/info.documotor.com\/?page_id=3301","title":{"rendered":"Distinct"},"content":{"rendered":"\n<p>This function removes duplicate values from an array.<\/p>\n\n\n\n<h3>Syntax<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">array distinct(array $input)<\/code><\/pre>\n\n\n\n<h3>Parameters<\/h3>\n\n\n\n<p><strong>$input:<\/strong> The array to make distinct.<\/p>\n\n\n\n<h3>Example<\/h3>\n\n\n\n<p><\/p>\n\n\n\n<pre title=\"Data\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json line-numbers\">{\n    \"input\": [\n        { \"name\": \"Bob\", \"id\": 0 },\n        { \"name\": \"Ann\", \"id\": 0 },\n        { \"name\": \"Joe\", \"id\": 1 },\n        { \"name\": \"Joe\", \"id\": 1 }\n    ]\n}<\/code><\/pre>\n\n\n\n<pre title=\"Transformation\" class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash line-numbers\">{\n    DistinctArray: distinct(input)\n}<\/code><\/pre>\n\n\n\n<pre title=\"Output\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json line-numbers\">{\n    \"DistinctArray\": [\n        { \"name\": \"Bob\", \"id\": 0 },\n        { \"name\": \"Ann\", \"id\": 0 },\n        { \"name\": \"Joe\", \"id\": 1 }\n    ]\n}<\/code><\/pre>\n\n\n\n<p>The function evaluates the properties of the objects. And as input[2] and input[3] is identical, the duplicate is removed.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This function removes duplicate values from an array. Syntax Parameters $input: The array to make distinct. Example The function evaluates the properties of the objects. And as input[2] and input[3] is identical, the duplicate is removed.<\/p>\n","protected":false},"author":5,"featured_media":0,"parent":271,"menu_order":31,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/info.documotor.com\/index.php?rest_route=\/wp\/v2\/pages\/3301"}],"collection":[{"href":"https:\/\/info.documotor.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/info.documotor.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/info.documotor.com\/index.php?rest_route=\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/info.documotor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3301"}],"version-history":[{"count":7,"href":"https:\/\/info.documotor.com\/index.php?rest_route=\/wp\/v2\/pages\/3301\/revisions"}],"predecessor-version":[{"id":3846,"href":"https:\/\/info.documotor.com\/index.php?rest_route=\/wp\/v2\/pages\/3301\/revisions\/3846"}],"up":[{"embeddable":true,"href":"https:\/\/info.documotor.com\/index.php?rest_route=\/wp\/v2\/pages\/271"}],"wp:attachment":[{"href":"https:\/\/info.documotor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3301"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}