{"id":109,"date":"2009-07-22T15:43:35","date_gmt":"2009-07-22T15:43:35","guid":{"rendered":"http:\/\/ketoha.co.jp\/blog\/archives\/109"},"modified":"2015-01-02T07:48:29","modified_gmt":"2015-01-02T07:48:29","slug":"array_unique%e9%96%a2%e6%95%b0%e3%81%ae%e6%b5%b7%e3%81%a7%e6%b5%b7%e8%b3%8a5-2-9%e8%88%b9%e5%9b%a3%e3%81%a8%e6%88%a6%e3%81%86","status":"publish","type":"post","link":"https:\/\/ketoha.co.jp\/blog\/?p=109","title":{"rendered":"array_unique\u95a2\u6570\u306e\u6d77\u3067\u6d77\u8cca5.2.9\u8239\u56e3\u3068\u6226\u3046"},"content":{"rendered":"<p>PHP\u306e\u304a\u8a71\u3067\u3059\u3002\u3082\u3057\u304b\u3057\u305f\u3089\u6d77\u8cca\u306e\u304a\u8a71\u3067\u3059\u3002<br \/>\n\u6614\u3001\u3042\u308b\u6d77\u57df\u3067\u306f\u6d77\u8cca\u305f\u3061\u306f\u6c7a\u3057\u3066\u5805\u6c17\u306e\u8239\u3092\u8972\u3044\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u4e16\u754c\u306e\u6210\u308a\u7acb\u3061\u306f\u4eca\u3088\u308a\u3044\u304f\u3076\u3093\u30b7\u30f3\u30d7\u30eb\u3067\u3001\u4efb\u4fa0\u306b\u306f\u307e\u3060\u7f8e\u5b66\u304c\u6b8b\u3063\u3066\u3044\u307e\u3057\u305f\u3002<br \/>\n\u305d\u3093\u306a\u308f\u3051\u3067\u6f01\u5e2b\u305f\u3061\u306f\u5b89\u5fc3\u3057\u3066\u6c96\u3078\u51fa\u3066\u3086\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002<br \/>\n\u3057\u304b\u3057\u3042\u308b\u5e74\u306b\u3001\u7834\u5929\u8352\u3067\u3084\u3093\u3061\u3083\u306a\u6d77\u8cca(5.2.9\u8239\u56e3)\u304c\u51fa\u73fe\u3001\u305d\u306e\u6d77\u57df\u3092\u5e2d\u5dfb\u3057\u3001\u6f01\u5e2b\u4ee5\u5916\u306e\u8239\u3082\u305f\u3073\u305f\u3073\u8972\u308f\u308c\u308b\u3068\u3044\u3046\u4e8b\u614b\u304c\u8d77\u3053\u308a\u307e\u3057\u305f\u3002<br \/>\n\u6f01\u8239\u306f\u8972\u308f\u306a\u3044\u304c\u3001\u305d\u308c\u4ee5\u5916\u306f\u306a\u3093\u3067\u3042\u308d\u3046\u3068\u7565\u596a\u3059\u308b\u3068\u3044\u3046\u306e\u304c\u3001\u5f7c\u3089\u306e\u30e2\u30c3\u30c8\u30fc\u3067\u3059\u3002<br \/>\n\u6f01\u5e2b\u306b\u306f\u307e\u3060\u540c\u3058\u6d77\u3092\u751f\u304d\u308b\u7537\u3068\u3057\u3066\u306e\u591a\u5c11\u306a\u308a\u306e\u30ea\u30b9\u30da\u30af\u30c8\u306e\u3088\u3046\u306a\u3082\u306e\u304c\u50cd\u3044\u3066\u3044\u305f\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u305d\u3046\u3067\u306a\u3051\u308c\u3070\u305f\u3068\u3048\u8001\u4eba\u3068\u4e00\u5339\u306e\u72ac\u3057\u304b\u4e57\u3063\u3066\u3044\u306a\u3044\u3088\u3046\u306a\u7121\u90aa\u6c17\u306a\u8239\u3067\u3082\u3001\u6d77\u3078\u51fa\u305f\u7406\u7531\u304c\u7d20\u3063\u9813\u72c2\u306a\u3082\u306e\u3067\u3042\u308c\u3070\u3001\u305d\u308c\u306f\u3082\u3046\u3082\u307f\u304f\u3061\u3083\u306e\u3072\u3069\u3044\u76ee\u306b\u3042\u3044\u307e\u3057\u305f\u3002<br \/>\n\u6f01\u5e2b\u3068\u3057\u3066\u3082\u3001\u6f01\u5e2b\u306e\u5448\u3092\u6210\u3057\u3066\u3044\u306a\u3051\u308c\u3070\u8001\u4eba\u3084\u72ac\u306e\u3088\u3046\u306b\u6271\u308f\u308c\u305f\u306e\u3067\u4eca\u307e\u3067\u306e\u3088\u3046\u306b\u306f\u5b89\u5fc3\u3057\u3066\u66ae\u3089\u305b\u307e\u305b\u3093\u3002<br \/>\n\u4e0d\u5b89\u3067\u6f01\u7372\u9ad8\u304c\u6e1b\u308a\u307e\u3057\u305f\u3002<br \/>\n\u6d77\u8cca\u306e\u7537\u6c17\u306b\u3082\u3084\u306f\u308a\u62b5\u89e6\u3059\u308b\u3082\u306e\u304c\u3042\u3063\u305f\u306e\u3067\u3057\u3087\u3046\u304b\u3001\u7fcc\u5e74\u304b\u3089\u5e78\u3044\u306b\u3082\u3001\u3084\u306f\u308a\u5805\u6c17\u306e\u8239\u306f\u8972\u3046\u307e\u3044\u3068\u3001\u304b\u3064\u3066\u306e\u6697\u9ed9\u306e\u30eb\u30fc\u30eb\u304c\u5fa9\u6d3b\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3057\u305f\u3002<br \/>\n\u3053\u308c\u3067\u4ee5\u524d\u306e\u7a4f\u3084\u304b\u306a\u66ae\u3089\u3057\u306b\u623b\u308c\u308b\u3068\u3001\u6f01\u5e2b\u305f\u3061\u306f\u5b89\u5835\u306e\u80f8\u3092\u306a\u3067\u304a\u308d\u3057\u307e\u3057\u305f\u304c\u3001\u3053\u3068\u306f\u305d\u3046\u7c21\u5358\u306b\u306f\u53ce\u307e\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002<br \/>\n\u3084\u3093\u3061\u3083\u306a\u6d77\u8cca(5.2.9\u8239\u56e3)\u306f\u3001\u6d77\u8cca\u3067\u3042\u308b\u304c\u3086\u3048\u306b\u3001\u4e00\u5ea6\u3042\u3052\u305f\u65d7\u3092\u304a\u308d\u3059\u306e\u3068\u540c\u3058\u304f\u3089\u3044\u3001\u524d\u8a00\u64a4\u56de\u3092\u5acc\u3044\u307e\u3057\u305f\u3002\u4e00\u5ea6\u7537\u304c\u53e3\u306b\u3057\u305f\u4ee5\u4e0a\u3001\u306a\u3093\u3068\u3057\u3066\u3082\u6f01\u5e2b\u4ee5\u5916\u306e\u8239\u306f\u7565\u53d6\u5f37\u596a\u306e\u30bf\u30fc\u30b2\u30c3\u30c8\u306a\u306e\u3067\u3059\u3002<br \/>\n\u305d\u3057\u3066\u4eca\u3067\u3082\u3053\u306e\u6d77\u57df\u3067\u5f7c\u3089\u306f\u76ee\u3092\u5149\u3089\u305b\u3066\u3044\u308b\u306e\u3067\u3059\u3002<br \/>\n\u6f01\u5e2b\u306b\u544a\u3050\u3002\u8972\u308f\u308c\u305f\u304f\u306a\u304f\u3070\u3001\u6f01\u5e2b\u3089\u3057\u304f\u305b\u3088\u3001\u306a\u3069\u3068\u5f7c\u3089\u304c\u8a00\u3063\u305f\u304b\u3069\u3046\u304b\u306f\u5b9a\u304b\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u3001\u305d\u308c\u4ee5\u6765\u3001\u6f01\u5e2b\u305f\u3061\u306f\u73fe\u5728\u3067\u3082\u304d\u3061\u3063\u3068\u3001\u4ed6\u306e\u8239\u3068\u5224\u5225\u3067\u304d\u308b\u3088\u3046\u306b\u3001\u6f01\u8239\u306b\u9ad8\u3005\u3068\u6f01\u8239\u65d7\u3092\u63b2\u3052\u3066\u3044\u308b\u305d\u3046\u3067\u3059\u3002<br \/>\n\u50d5\u305f\u3061\u306e\u66ae\u3089\u3059\u6d77\u306f\u5e73\u548c\u3067\u3088\u304b\u3063\u305f\u3067\u3059\u306d\u3002<br \/>\n\u3044\u3084\u3001PHP\u306e\u8a71\u3067\u3057\u305f\u3002<br \/>\n\u3084\u3093\u3061\u3083\u306a\u6d77\u8cca: <strong>PHP ver5.2.9<\/strong><br \/>\n\u6d77\u306e\u540d\u524d: <strong>array_unique()<\/strong><br \/>\n\u6697\u9ed9\u306e\u30eb\u30fc\u30eb: <strong>\u30c7\u30d5\u30a9\u30eb\u30c8\u5f15\u6570<\/strong><br \/>\n\u5805\u6c17\u306e\u8239\u306f\u8972\u308f\u306a\u3044: <strong>SORT_STRING<\/strong>(\u6587\u5b57\u5217\u6bd4\u8f03)<br \/>\n\u6f01\u8239\u306f\u8972\u308f\u306a\u3044: <strong>SORT_REGULAR<\/strong>(\u901a\u5e38\u306e\u6bd4\u8f03)<br \/>\n\u30d0\u30fc\u30b8\u30e7\u30f35.2.9\u307e\u3067\u306ePHP\u3067\u306f\u3001array_unique\u95a2\u6570\u306b\u7b2c\uff12\u5f15\u6570\u306f\u5b58\u5728\u3057\u307e\u305b\u3093\u3067\u3057\u305f\u3002<br \/>\n\u7b2c\uff11\u5f15\u6570\u306b\u914d\u5217\u3092\u6e21\u3059\u3060\u3051\u3067\u3001\u6697\u9ed9\u306e\u30eb\u30fc\u30eb\u3068\u3057\u3066\u8981\u7d20\u3092\u300c\u6587\u5b57\u5217\u3068\u3057\u3066\u300d\u6bd4\u8f03\u3001\u30bd\u30fc\u30c8\u3057\u3066\u3044\u307e\u3057\u305f\u3002<br \/>\n\u3057\u304b\u30575.2.9\u304b\u3089\u3001array_unique\u95a2\u6570\u306f\u7b2c\uff12\u5f15\u6570\u3092\u8a2d\u3051\u3066\u3001\u30bd\u30fc\u30c8\u65b9\u6cd5\u3092\u9078\u3079\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u304c\u3001\u660e\u793a\u3057\u306a\u304b\u3063\u305f(\u65d7\u3092\u63b2\u3052\u306a\u304b\u3063\u305f)\u5834\u5408\u3001\u578b\u3092\u8003\u616e\u3057\u306a\u3044\u300c\u901a\u5e38\u306e\u6bd4\u8f03\u3067\u300d\u30bd\u30fc\u30c8\u3055\u308c\u308b\u3053\u3068\u3068\u306a\u308a\u307e\u3057\u305f\u3002<br \/>\n\u3053\u3053\u3067\u30015.2.9\u306f\u4e0b\u4f4d\u4e92\u63db\u3092\u5931\u3063\u305f\u3053\u3068\u3068\u306a\u308a\u307e\u3059\u3002<br \/>\n\u305d\u306e\u5f8c\u5185\u90e8\u3067\u3044\u308d\u3044\u308d\u3042\u3063\u305f\u306e\u3067\u3057\u3087\u3046\u304b\u3001\u6b21\u306e\u30d0\u30fc\u30b8\u30e7\u30f35.2.10\u304b\u3089\u306f\u660e\u793a\u3057\u306a\u304b\u3063\u305f\u5834\u5408\u306e\u6319\u52d5\u306f\u3001\u518d\u3073\u300c\u6587\u5b57\u5217\u3068\u3057\u3066\u300d\u6bd4\u8f03\u3001\u30bd\u30fc\u30c8\u3059\u308b\u3088\u3046\u306b\u5909\u66f4\u3055\u308c\u307e\u3057\u305f\u3002<br \/>\n\u4f7f\u7528\u3055\u308c\u3066\u3044\u308bPHP\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u3059\u3067\u306b5.2.9\u8d85\u3067\u3042\u308b\u3001\u3082\u3057\u304f\u306f\u7b2c\uff12\u5f15\u6570\u3092\u660e\u793a\u3057\u3066\u3044\u308b\u3001\u3068\u3044\u3046\u306e\u3067\u306a\u3051\u308c\u3070\u3001\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u3092\u304a\u3053\u306a\u3063\u305f\u9014\u7aef\u306b\u904b\u7528\u4e2d\u306e\u30b5\u30fc\u30d3\u30b9\u306b\u652f\u969c\u3092\u304d\u305f\u3059\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<br \/>\n\u305f\u3068\u3048\u3070DB\u304b\u3089\u5546\u54c1\u306e\u7d2f\u7a4d\u4eba\u6c17\u6295\u7968\u3092\u914d\u5217\u306b\u53d6\u5f97\u3057\u3066\u3001\u305d\u3053\u304b\u3089\u6295\u7968\u7406\u7531\u3084\u4ed8\u4e0e\u30dd\u30a4\u30f3\u30c8\u3054\u3068\u306b\u30bd\u30fc\u30c8\u3057\u3066\u9806\u4f4d\u3092\u767a\u8868\u3068\u304b\u3057\u3066\u3044\u308b\u3068\u30015.2.9\u3060\u3051\u7d50\u679c\u304c\u7570\u306a\u308b\u3001\u3068\u304b5.2.9\u4ee5\u5916\u3067\u306f\u7d50\u679c\u304c\u7570\u306a\u308b\u3001\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<br \/>\n\u4f8b\u3092\u307f\u3066\u307f\u307e\u3059\u3002<\/p>\n<blockquote><p>$array = array(0, &#8216;000&#8217;, &#8216;hello&#8217;, &#8216;world&#8217;);<br \/>\n\/\/ ver5.2.9\u4ee5\u5916<br \/>\nvar_dump(array_unique($array));<br \/>\n\/\/ array(4) { [0]=&gt; int(0) [1]=&gt; string(3) &#8220;000&#8221; [2]=&gt; string(5) &#8220;hello&#8221; [3]=&gt; string(5) &#8220;world&#8221; }<br \/>\n\/\/ ver5.2.9<br \/>\nvar_dump(array_unique($array));<br \/>\n\/\/ array(1) { [0]=&gt; int(0) }<\/p><\/blockquote>\n<p>5.2.9\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u5f15\u6570\u306eSORT_REGULAR\u3067\u306f\u3001\u578b\u304c\u8003\u616e\u3055\u308c\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u6700\u521d\u306e\u6570\u50240\u306b\u6bd4\u3079\u3089\u308c\u3066\u3001\u3059\u3079\u3066\u7b49\u4fa1\u3067\u3042\u308b\u3068\u307f\u306a\u3055\u308c\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<br \/>\n\u3068\u3044\u3046\u308f\u3051\u3067\u30015.2.9\u3092\u4f7f\u7528\u3055\u308c\u3066\u3044\u3066\u3001\u7b2c\uff12\u5f15\u6570\u3092\u660e\u793a\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u3001\u4e92\u63db\u6027\u3092\u78ba\u4fdd\u3059\u308b\u305f\u3081\u306b<\/p>\n<blockquote><p>$array = array_unique($array, SORT_REGULAR);<\/p><\/blockquote>\n<p>\u3068\u3057\u307e\u3057\u3087\u3046\u3002\u305d\u3046\u3059\u308b\u3053\u3068\u30675.2.9\u8d85\u3067\u3082\u540c\u3058\u52d5\u4f5c\u3092\u3057\u3066\u304f\u308c\u307e\u3059\u3002<br \/>\n5.2.9\u4ee5\u524d\u3067\u3001\u7b2c\uff12\u5f15\u6570\u304c\u5b58\u5728\u3057\u306a\u3044\u5834\u5408\u306f<\/p>\n<blockquote><p>$array = version_compare(PHP_VERSION, &#8216;5.2.9&#8217;, &#8216;&gt;=&#8217;) ? array_unique($array, SORT_STRING) : array_unique($array);<\/p><\/blockquote>\n<p>\u3068\u3057\u307e\u3057\u3087\u3046\u3002\u305d\u3046\u3059\u308b\u3053\u3068\u3067\u30015.2.9\u3067\u30825.2.9\u8d85\u3067\u3082\u30015.2.9\u4ee5\u524d\u3068\u540c\u3058SORT_STRING\u3067\u52d5\u3044\u3066\u304f\u308c\u307e\u3059\u3002<br \/>\n\u3053\u308c\u306f\u8239\u306b\u9ad8\u3005\u3068\u63b2\u3052\u3089\u308c\u305f\u6f01\u8239\u65d7\u306e\u30e1\u30bf\u30d5\u30a1\u30fc\u3067\u3059\u3002<\/p>\n<p># \u9593\u9055\u3044\u3084\u3088\u308a\u3044\u3044\u65b9\u6cd5\u304c\u3042\u308c\u3070\u3069\u3046\u305e\u3054\u6307\u6458\u304f\u3060\u3055\u3044\u3002<br \/>\n\u53c2\u8003:<br \/>\n<a href=\"http:\/\/d.hatena.ne.jp\/hnw\/20090228\">array_unique\u95a2\u6570\u304cPHP5.2.9\u304b\u3089\u5f8c\u65b9\u4e92\u63db\u6027\u3092\u5931\u3044\u307e\u3057\u305f &#8211; hnw\u306e\u65e5\u8a18 &#8211;<\/a><br \/>\n<a href=\"http:\/\/jp2.php.net\/array_unique\">PHP:array_unique &#8211; Manual &#8211;<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP\u306e\u304a\u8a71\u3067\u3059\u3002\u3082\u3057\u304b\u3057\u305f\u3089\u6d77\u8cca\u306e\u304a\u8a71\u3067\u3059\u3002 \u6614\u3001\u3042\u308b\u6d77\u57df\u3067\u306f\u6d77\u8cca\u305f\u3061\u306f\u6c7a\u3057\u3066\u5805\u6c17\u306e\u8239\u3092\u8972\u3044\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u4e16\u754c\u306e\u6210\u308a\u7acb\u3061\u306f\u4eca\u3088\u308a\u3044\u304f\u3076\u3093\u30b7\u30f3\u30d7\u30eb\u3067\u3001\u4efb\u4fa0\u306b\u306f\u307e\u3060\u7f8e\u5b66\u304c\u6b8b\u3063\u3066\u3044\u307e\u3057\u305f\u3002 \u305d\u3093\u306a\u308f\u3051\u3067\u6f01\u5e2b\u305f\u3061\u306f\u5b89\u5fc3\u3057\u3066\u6c96\u3078<a class=\"moretag read-more-link\" href=\"https:\/\/ketoha.co.jp\/blog\/?p=109\">&#133;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":{"0":"entry","1":"post","2":"publish","3":"author-ketoher","4":"post-109","6":"format-standard","7":"category-tech"},"_links":{"self":[{"href":"https:\/\/ketoha.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/109","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ketoha.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ketoha.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ketoha.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ketoha.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=109"}],"version-history":[{"count":1,"href":"https:\/\/ketoha.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/109\/revisions"}],"predecessor-version":[{"id":170,"href":"https:\/\/ketoha.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/109\/revisions\/170"}],"wp:attachment":[{"href":"https:\/\/ketoha.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=109"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ketoha.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=109"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ketoha.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}