
{"id":2692,"date":"2018-10-25T17:30:50","date_gmt":"2018-10-25T09:30:50","guid":{"rendered":"https:\/\/www.webteach.tw\/?p=2692"},"modified":"2018-10-25T17:30:50","modified_gmt":"2018-10-25T09:30:50","slug":"how-to-remove-an-array-element-on-key-%e5%a6%82%e4%bd%95%e4%be%9d%e9%99%a3%e5%88%97key%e5%80%bc%e7%a7%bb%e9%99%a4%e6%9f%90%e5%80%8b%e9%99%a3%e5%88%97%e5%85%83%e7%b4%a0%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.webteach.tw\/?p=2692","title":{"rendered":"[ PHP ] &#8211; How to remove an array element on key? \u5982\u4f55\u4f9d\u9663\u5217key\u503c\u79fb\u9664\u67d0\u500b\u9663\u5217\u5143\u7d20\uff1f"},"content":{"rendered":"<div style='text-align:center' class='yasr-auto-insert-overall'><\/div><div style='text-align:center' class='yasr-auto-insert-visitor'><\/div><div style=\"margin-top: 0px; margin-bottom: 0px;\" class=\"sharethis-inline-share-buttons\" ><\/div>\n<p>How to remove an array element on key? \u5982\u4f55\u4f9d\u9663\u5217key\u503c\u79fb\u9664\u67d0\u500b\u9663\u5217\u5143\u7d20\uff1f<\/p>\n\n\n<p>\u5176\u5be6\u5f88\u55ae<br \/>\u8209\u4f8b\u6211\u6709\u500b<\/p>\n\n\n<p>\u4f46\u6709\u6642\u5019\u6709\u4e9b\u6b04\u4f4d\u662f\u4f60\u586bA\u6b04 B\u6b04\u5c31\u8b8a\u975e\u5fc5\u586b\uff0c\u586bB\u6b04 A\u6b04\u5c31\u8b8a\u975e\u5fc5\u586b,\u4e5f\u5c31\u662f\u5169\u6b04\u53ea\u8981\u4e00\u6b04\u6709\u503c\u5c31\u53ef\u4ee5\u3002<\/p>\n\n\n<pre class=\"wp-block-code\"><code>$a=array('a'=>'111','b'=>'222','c'=>'333');\nunset($a&#091;'a']);<\/code><\/pre>\n\n\n<p>\u9019\u500b\u5f8c\u5c31\u5224\u65b7<\/p>\n\n\n<pre class=\"wp-block-code\"><code>if($_POST&#091;'a']!=''){unset($a&#091;'b']);}\nif($_POST&#091;'b']!=''){unset($a&#091;'a']);}<\/code><\/pre>\n\n\n<p>\u9019\u6a23\u5c31\u53ef\u4ee5\u8b8a\u9078\u586b\uff0c\u4f46\u5169\u500b\u5fc5\u9700\u6709\u4e00\u500b\u6709\u503c<\/p>\n\n\n<p>\u4ee5\u6211\u7684\u4f7f\u7528\u60c5\u5883\u662f\uff0c\u6211\u6709\u500b\u9078\u64c7\u5668\uff0c\u6703\u53bb\u5224\u65b7\u524d\u7aef\u50b3\u4f86\u7684\u53c3\u6578\u90a3\u4e9b\u662f\u4e0d\u53ef\u4ee5\u70ba\u7a7a\u503c\uff0c\u4e5f\u5c31\u662f\u5fc5\u586b\u7684\u6b04\u4f4d\u3002\u6211\u4ee5\u4e00\u500b\u9663\u5217\u5b58\u90a3\u4e9b\u6b04\u4f4d\u662f\u5fc5\u586b\u7684<\/p>\n<div style='text-align:center' class='yasr-auto-insert-overall'><\/div><div style='text-align:center' class='yasr-auto-insert-visitor'><\/div>","protected":false},"excerpt":{"rendered":"<p>How to remove an arr [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"yasr_overall_rating":0,"yasr_post_is_review":"","yasr_auto_insert_disabled":"","yasr_review_type":"","footnotes":""},"categories":[43,36],"tags":[121,448,486,586],"class_list":["post-2692","post","type-post","status-publish","format-standard","hentry","category-array","category-php","tag-array","tag-php","tag-remove-an-array-element-on-key","tag-unset"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>[ PHP ] - How to remove an array element on key? \u5982\u4f55\u4f9d\u9663\u5217key\u503c\u79fb\u9664\u67d0\u500b\u9663\u5217\u5143\u7d20\uff1f - \u6df7\u6c34\u6478\u9b5a<\/title>\n<meta name=\"description\" content=\"How to remove an array element on key? \u5982\u4f55\u4f9d\u9663\u5217key\u503c\u79fb\u9664\u67d0\u500b\u9663\u5217\u5143\u7d20\uff1f\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webteach.tw\/?p=2692\" \/>\n<meta property=\"og:locale\" content=\"zh_TW\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[ PHP ] - How to remove an array element on key? \u5982\u4f55\u4f9d\u9663\u5217key\u503c\u79fb\u9664\u67d0\u500b\u9663\u5217\u5143\u7d20\uff1f - \u6df7\u6c34\u6478\u9b5a\" \/>\n<meta property=\"og:description\" content=\"How to remove an array element on key? \u5982\u4f55\u4f9d\u9663\u5217key\u503c\u79fb\u9664\u67d0\u500b\u9663\u5217\u5143\u7d20\uff1f\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webteach.tw\/?p=2692\" \/>\n<meta property=\"og:site_name\" content=\"\u6df7\u6c34\u6478\u9b5a\" \/>\n<meta property=\"article:published_time\" content=\"2018-10-25T09:30:50+00:00\" \/>\n<meta name=\"author\" content=\"jeff\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005:\" \/>\n\t<meta name=\"twitter:data1\" content=\"jeff\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=2692#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=2692\"},\"author\":{\"name\":\"jeff\",\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/#\\\/schema\\\/person\\\/d434d754fd581338113eecfa923d7520\"},\"headline\":\"[ PHP ] &#8211; How to remove an array element on key? \u5982\u4f55\u4f9d\u9663\u5217key\u503c\u79fb\u9664\u67d0\u500b\u9663\u5217\u5143\u7d20\uff1f\",\"datePublished\":\"2018-10-25T09:30:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=2692\"},\"wordCount\":24,\"commentCount\":0,\"keywords\":[\"array\",\"php\",\"remove an array element on key\",\"unset\"],\"articleSection\":[\"array(\u9663\u5217)\",\"PHP\"],\"inLanguage\":\"zh-TW\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.webteach.tw\\\/?p=2692#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=2692\",\"url\":\"https:\\\/\\\/www.webteach.tw\\\/?p=2692\",\"name\":\"[ PHP ] - How to remove an array element on key? \u5982\u4f55\u4f9d\u9663\u5217key\u503c\u79fb\u9664\u67d0\u500b\u9663\u5217\u5143\u7d20\uff1f - \u6df7\u6c34\u6478\u9b5a\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/#website\"},\"datePublished\":\"2018-10-25T09:30:50+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/#\\\/schema\\\/person\\\/d434d754fd581338113eecfa923d7520\"},\"description\":\"How to remove an array element on key? \u5982\u4f55\u4f9d\u9663\u5217key\u503c\u79fb\u9664\u67d0\u500b\u9663\u5217\u5143\u7d20\uff1f\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=2692#breadcrumb\"},\"inLanguage\":\"zh-TW\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.webteach.tw\\\/?p=2692\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=2692#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9801\",\"item\":\"https:\\\/\\\/www.webteach.tw\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[ PHP ] &#8211; How to remove an array element on key? \u5982\u4f55\u4f9d\u9663\u5217key\u503c\u79fb\u9664\u67d0\u500b\u9663\u5217\u5143\u7d20\uff1f\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/#website\",\"url\":\"https:\\\/\\\/www.webteach.tw\\\/\",\"name\":\"\u6df7\u6c34\u6478\u9b5a\",\"description\":\"\u5b78\u7121\u6b62\u5883,\u6559\u5b78\u76f8\u9577\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.webteach.tw\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-TW\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/#\\\/schema\\\/person\\\/d434d754fd581338113eecfa923d7520\",\"name\":\"jeff\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-TW\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5797200e421b670a2ce64d6e7382054c69b231d4aab55742c96bb1e51bc9fefc?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5797200e421b670a2ce64d6e7382054c69b231d4aab55742c96bb1e51bc9fefc?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5797200e421b670a2ce64d6e7382054c69b231d4aab55742c96bb1e51bc9fefc?s=96&d=mm&r=g\",\"caption\":\"jeff\"},\"sameAs\":[\"http:\\\/\\\/35.72.55.111\"],\"url\":\"https:\\\/\\\/www.webteach.tw\\\/?author=1\"},false]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[ PHP ] - How to remove an array element on key? \u5982\u4f55\u4f9d\u9663\u5217key\u503c\u79fb\u9664\u67d0\u500b\u9663\u5217\u5143\u7d20\uff1f - \u6df7\u6c34\u6478\u9b5a","description":"How to remove an array element on key? \u5982\u4f55\u4f9d\u9663\u5217key\u503c\u79fb\u9664\u67d0\u500b\u9663\u5217\u5143\u7d20\uff1f","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webteach.tw\/?p=2692","og_locale":"zh_TW","og_type":"article","og_title":"[ PHP ] - How to remove an array element on key? \u5982\u4f55\u4f9d\u9663\u5217key\u503c\u79fb\u9664\u67d0\u500b\u9663\u5217\u5143\u7d20\uff1f - \u6df7\u6c34\u6478\u9b5a","og_description":"How to remove an array element on key? \u5982\u4f55\u4f9d\u9663\u5217key\u503c\u79fb\u9664\u67d0\u500b\u9663\u5217\u5143\u7d20\uff1f","og_url":"https:\/\/www.webteach.tw\/?p=2692","og_site_name":"\u6df7\u6c34\u6478\u9b5a","article_published_time":"2018-10-25T09:30:50+00:00","author":"jeff","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005:":"jeff"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webteach.tw\/?p=2692#article","isPartOf":{"@id":"https:\/\/www.webteach.tw\/?p=2692"},"author":{"name":"jeff","@id":"https:\/\/www.webteach.tw\/#\/schema\/person\/d434d754fd581338113eecfa923d7520"},"headline":"[ PHP ] &#8211; How to remove an array element on key? \u5982\u4f55\u4f9d\u9663\u5217key\u503c\u79fb\u9664\u67d0\u500b\u9663\u5217\u5143\u7d20\uff1f","datePublished":"2018-10-25T09:30:50+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webteach.tw\/?p=2692"},"wordCount":24,"commentCount":0,"keywords":["array","php","remove an array element on key","unset"],"articleSection":["array(\u9663\u5217)","PHP"],"inLanguage":"zh-TW","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webteach.tw\/?p=2692#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webteach.tw\/?p=2692","url":"https:\/\/www.webteach.tw\/?p=2692","name":"[ PHP ] - How to remove an array element on key? \u5982\u4f55\u4f9d\u9663\u5217key\u503c\u79fb\u9664\u67d0\u500b\u9663\u5217\u5143\u7d20\uff1f - \u6df7\u6c34\u6478\u9b5a","isPartOf":{"@id":"https:\/\/www.webteach.tw\/#website"},"datePublished":"2018-10-25T09:30:50+00:00","author":{"@id":"https:\/\/www.webteach.tw\/#\/schema\/person\/d434d754fd581338113eecfa923d7520"},"description":"How to remove an array element on key? \u5982\u4f55\u4f9d\u9663\u5217key\u503c\u79fb\u9664\u67d0\u500b\u9663\u5217\u5143\u7d20\uff1f","breadcrumb":{"@id":"https:\/\/www.webteach.tw\/?p=2692#breadcrumb"},"inLanguage":"zh-TW","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webteach.tw\/?p=2692"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.webteach.tw\/?p=2692#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9801","item":"https:\/\/www.webteach.tw\/"},{"@type":"ListItem","position":2,"name":"[ PHP ] &#8211; How to remove an array element on key? \u5982\u4f55\u4f9d\u9663\u5217key\u503c\u79fb\u9664\u67d0\u500b\u9663\u5217\u5143\u7d20\uff1f"}]},{"@type":"WebSite","@id":"https:\/\/www.webteach.tw\/#website","url":"https:\/\/www.webteach.tw\/","name":"\u6df7\u6c34\u6478\u9b5a","description":"\u5b78\u7121\u6b62\u5883,\u6559\u5b78\u76f8\u9577","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webteach.tw\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-TW"},{"@type":"Person","@id":"https:\/\/www.webteach.tw\/#\/schema\/person\/d434d754fd581338113eecfa923d7520","name":"jeff","image":{"@type":"ImageObject","inLanguage":"zh-TW","@id":"https:\/\/secure.gravatar.com\/avatar\/5797200e421b670a2ce64d6e7382054c69b231d4aab55742c96bb1e51bc9fefc?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5797200e421b670a2ce64d6e7382054c69b231d4aab55742c96bb1e51bc9fefc?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5797200e421b670a2ce64d6e7382054c69b231d4aab55742c96bb1e51bc9fefc?s=96&d=mm&r=g","caption":"jeff"},"sameAs":["http:\/\/35.72.55.111"],"url":"https:\/\/www.webteach.tw\/?author=1"},false]}},"views":770,"yasr_visitor_votes":{"stars_attributes":{"read_only":false,"span_bottom":false},"number_of_votes":0,"sum_votes":0},"_links":{"self":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/posts\/2692","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2692"}],"version-history":[{"count":0,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/posts\/2692\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2692"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2692"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}