{"id":1368,"date":"2019-05-09T13:54:07","date_gmt":"2019-05-09T04:54:07","guid":{"rendered":"https:\/\/clouds.tokyo\/blog\/?p=1368"},"modified":"2023-02-07T12:34:41","modified_gmt":"2023-02-07T03:34:41","slug":"php-sort","status":"publish","type":"post","link":"https:\/\/clouds.tokyo\/blog\/php-sort\/","title":{"rendered":"\u3010PHP\u3011\u914d\u5217\u3092\u4efb\u610f\u306e\u9805\u76ee\u3067\u30bd\u30fc\u30c8\u3059\u308b"},"content":{"rendered":"<p>\u9023\u60f3\u914d\u5217\u30921\u30c7\u30fc\u30bf\u3068\u3059\u308b\u914d\u5217\u3092\u4efb\u610f\u306e\u9805\u76ee\u3067\u30bd\u30fc\u30c8\u3057\u305f\u3044\u5834\u5408<\/p>\n<p>\u30c7\u30fc\u30bf\u306e\u4f8b<\/p>\n<pre>\r\n$list = [\r\n  {'name': '\u4f50\u85e4', 'age': 35, 'gender': 1},\r\n  {'name': '\u9234\u6728', 'age': 25, 'gender': 2},\r\n  {'name': '\u7530\u4e2d', 'age': 45, 'gender': 1},\r\n];\r\n<\/pre>\n<p>\u5e74\u9f62\u3067\u6607\u9806\u3067\u30bd\u30fc\u30c8<\/p>\n<pre>\r\n$sort = [];\r\nforeach($list as $row) {\r\n  $sort[] = $row['age'];\r\n}\r\narray_multisort($sort, SORT_ASC, SORT_NUMERIC , $list);\r\n<\/pre>\n<p>\u540d\u524d\uff0b\u6027\u5225\u306e\u964d\u9806\u3067\u30bd\u30fc\u30c8<\/p>\n<pre>\r\n$sort = [];\r\nforeach($list as $row) {\r\n  $sort[] = $row['name'] . $row['gender'];\r\n}\r\narray_multisort($sort, SORT_DESC, SORT_STRING , $list);\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u9023\u60f3\u914d\u5217\u30921\u30c7\u30fc\u30bf\u3068\u3059\u308b\u914d\u5217\u3092\u4efb\u610f\u306e\u9805\u76ee\u3067\u30bd\u30fc\u30c8\u3057\u305f\u3044\u5834\u5408 \u30c7\u30fc\u30bf\u306e\u4f8b $list = [ {&#8216;name&#8217;: &#8216;\u4f50\u85e4&#8217;, &#8216;age&#8217;: 35, &#8216;gender&#8217;: 1}, {&#8216;name&#8217;: &#8216;\u9234\u6728&#8217;, &#8216;age&#8217;: 25 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/clouds.tokyo\/blog\/php-sort\/\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u3010PHP\u3011\u914d\u5217\u3092\u4efb\u610f\u306e\u9805\u76ee\u3067\u30bd\u30fc\u30c8\u3059\u308b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":""},"categories":[2],"tags":[96,237,580],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pezW3u-m4","jetpack-related-posts":[{"id":1632,"url":"https:\/\/clouds.tokyo\/blog\/sortable-js\/","url_meta":{"origin":1368,"position":0},"title":"\u3010JavaScript\u3011SortableJS\u3067\u7c21\u5358\u306b\u4e26\u3079\u66ff\u3048UI\u3092\u4f5c\u308b","author":"yamamoto","date":"2024\u5e741\u670812\u65e5","format":false,"excerpt":"JavaScript\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u300cSortableJS\u300d\u3092\u4f7f\u3048\u3070 \u30c9\u30e9\u30c3\u30b0\uff06\u30c9\u30ed\u30c3\u30d7\u3067\u30ea\u30b9\u30c8\u306e\u4e26\u3073\u9806\u2026","rel":"","context":"\u30c4\u30fc\u30eb","block_context":{"text":"\u30c4\u30fc\u30eb","link":"https:\/\/clouds.tokyo\/blog\/category\/%e3%83%84%e3%83%bc%e3%83%ab\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":424,"url":"https:\/\/clouds.tokyo\/blog\/wp_cate_sort\/","url_meta":{"origin":1368,"position":1},"title":"\u3010WordPress\u3011\u30ab\u30c6\u30b4\u30ea\u30fc\u306e\u4e26\u3073\u9806\u3092\u30c9\u30e9\u30c3\u30b0\uff06\u30c9\u30ed\u30c3\u30d7\u3067\u8a2d\u5b9a\u3067\u304d\u308b\u30d7\u30e9\u30b0\u30a4\u30f3","author":"yamamoto","date":"2015\u5e7410\u67089\u65e5","format":false,"excerpt":"\u30d7\u30e9\u30b0\u30a4\u30f3\u540d\uff1a\u300cCategory Order and Taxonomy Terms Order\u300d \u30a4\u2026","rel":"","context":"\u5099\u5fd8\u9332","block_context":{"text":"\u5099\u5fd8\u9332","link":"https:\/\/clouds.tokyo\/blog\/category\/memo\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":917,"url":"https:\/\/clouds.tokyo\/blog\/win_exp_sort\/","url_meta":{"origin":1368,"position":2},"title":"\u3010Windows\u3011\u30a8\u30af\u30b9\u30d7\u30ed\u30fc\u30e9\u30fc\u3067\u65e5\u4ed8\u9806\u306b\u3057\u305f\u3068\u304d\u306b\u30d5\u30a9\u30eb\u30c0\u3092\u4e0a\u306b\u56fa\u5b9a\u3059\u308b\u306b\u306f","author":"yamamoto","date":"2017\u5e7412\u670822\u65e5","format":false,"excerpt":"\u3044\u3064\u304b\u3089\u304b\u5fd8\u308c\u307e\u3057\u305f\u304c\u3001 Windows\u306e\u30a8\u30af\u30b9\u30d7\u30ed\u30fc\u30e9\u30fc\u3067\u66f4\u65b0\u65e5\u6642\u306e\u964d\u9806\u3001\u3064\u307e\u308a\u65b0\u3057\u3044\u9806\u306b\u4e26\u3073\u66ff\u3048\u2026","rel":"","context":"\u5099\u5fd8\u9332","block_context":{"text":"\u5099\u5fd8\u9332","link":"https:\/\/clouds.tokyo\/blog\/category\/memo\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":581,"url":"https:\/\/clouds.tokyo\/blog\/mysql_sort_num\/","url_meta":{"origin":1368,"position":3},"title":"\u3010MySQL\u3011order by\u3067\u6587\u5b57\u5217\u30ab\u30e9\u30e0\u3092\u6570\u5024\u3068\u3057\u3066\u30bd\u30fc\u30c8\u3059\u308b","author":"yamamoto","date":"2009\u5e746\u670828\u65e5","format":false,"excerpt":"\u30ab\u30e9\u30e0\u304cvarchar\u578b\u3060\u3051\u3069\u6570\u5024\u3068\u3057\u3066\u30bd\u30fc\u30c8\u3057\u305f\u3044\u5834\u5408\u3067\u3059\u3002 order by id \u306e\u3088\u3046\u306b\u305d\u306e\u2026","rel":"","context":"\u5099\u5fd8\u9332","block_context":{"text":"\u5099\u5fd8\u9332","link":"https:\/\/clouds.tokyo\/blog\/category\/memo\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":804,"url":"https:\/\/clouds.tokyo\/blog\/excel_sort\/","url_meta":{"origin":1368,"position":4},"title":"\u3010Excel\u3011\u57fa\u6e96\u3068\u306a\u308b\u5217\u3092\u6307\u5b9a\u3057\u3066\u884c\u5168\u4f53\u3092\u4e26\u3073\u66ff\u3048\u308b","author":"yamamoto","date":"2017\u5e749\u670819\u65e5","format":false,"excerpt":"Excel\u306e\u3061\u3087\u3063\u3068\u3057\u305f\u64cd\u4f5c\u3082\u6570\u30f6\u6708\uff5e1\u5e74\u5358\u4f4d\u3067\u4f7f\u3063\u3066\u3044\u306a\u304b\u3063\u305f\u308a\u3059\u308b\u3068 \u3084\u308a\u65b9\u3092\u5fd8\u308c\u3066\u3044\u305f\u308a\u3057\u307e\u3059\u2026","rel":"","context":"\u5099\u5fd8\u9332","block_context":{"text":"\u5099\u5fd8\u9332","link":"https:\/\/clouds.tokyo\/blog\/category\/memo\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":121,"url":"https:\/\/clouds.tokyo\/blog\/ps_rss\/","url_meta":{"origin":1368,"position":5},"title":"\u3010Linux\u3011ps\u30b3\u30de\u30f3\u30c9\u3067\u30d7\u30ed\u30bb\u30b9\u306e\u30e1\u30e2\u30ea\u6d88\u8cbb\u3092\u78ba\u8a8d","author":"yamamoto","date":"2009\u5e7410\u67084\u65e5","format":false,"excerpt":"ps\u30b3\u30de\u30f3\u30c9\u3067\u30d7\u30ed\u30bb\u30b9\u306e\u8d77\u52d5\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u306f\u3088\u304f\u3042\u308a\u307e\u3059\u304c\u3001 \u5148\u65e5\u3001Java\u306b\u3088\u308b\u696d\u52d9\u30b7\u30b9\u30c6\u30e0\u304c\u7a3c\u50cd\u2026","rel":"","context":"\u5099\u5fd8\u9332","block_context":{"text":"\u5099\u5fd8\u9332","link":"https:\/\/clouds.tokyo\/blog\/category\/memo\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/posts\/1368"}],"collection":[{"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/comments?post=1368"}],"version-history":[{"count":1,"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/posts\/1368\/revisions"}],"predecessor-version":[{"id":1369,"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/posts\/1368\/revisions\/1369"}],"wp:attachment":[{"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/media?parent=1368"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/categories?post=1368"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/clouds.tokyo\/blog\/wp-json\/wp\/v2\/tags?post=1368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}