{"id":1751,"date":"2016-12-22T20:45:52","date_gmt":"2016-12-22T11:45:52","guid":{"rendered":"http:\/\/alaki.co.jp\/blog\/?p=1751"},"modified":"2016-12-22T20:45:52","modified_gmt":"2016-12-22T11:45:52","slug":"php%e5%88%86%e5%89%b2%e9%96%a2%e6%95%b0%e3%81%ae%e7%a7%81%e7%9a%84%e3%83%99%e3%82%b9%e3%83%88%e3%83%97%e3%83%a9%e3%82%af%e3%83%86%e3%82%a3%e3%82%b9","status":"publish","type":"post","link":"http:\/\/test.alaki.co.jp\/blog\/?p=1751","title":{"rendered":"PHP\u5206\u5272\u95a2\u6570\u306e\u79c1\u7684\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9"},"content":{"rendered":"<p>\u3053\u3093\u3070\u3093\u306f\u3001Web\u30d7\u30ed\u30b0\u30e9\u30de\u306e\u7be0\u7530\u3067\u3059\u3002<\/p>\n<p>\u3042\u3068\u300110\u56de\u307b\u3069\u5bdd\u308b\u3068\u304a\u6b63\u6708\u3067\u3059\u306d\u3002\u307e\u3060\u3001\u30af\u30ea\u30b9\u30de\u30b9\u3082\u6b8b\u3057\u3066\u3044\u307e\u3059\u304c2016\u5e74\u306e\u79c1\u306e\u56de\u306f\u4eca\u56de\u3067\u7d42\u308a\u3068\u306a\u308a\u307e\u3059\u3002<br \/>\n\u6b21\u56de\u306f\u300c\u3042\u3051\u304a\u3081\u300d\u3067\u30b9\u30bf\u30fc\u30c8\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u305d\u3046\u3067\u3059\u3002<\/p>\n<p>\u3055\u3066\u3001\u4eca\u56de\u306f\u300cPHP\u306e\u610f\u5916\u3068\u77e5\u3063\u3066\u3044\u308b\u3088\u3046\u3067\u77e5\u3063\u3066\u3044\u308b\uff1f\uff1f\u300d\u30b7\u30ea\u30fc\u30ba\u3068\u984c\u3057\u3066\u300c\u6587\u5b57\u5217\u300d\u306e\u300c\u5206\u5272\u300d\u306b\u95a2\u3057\u3066\u3054\u7d39\u4ecb\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<h2>\u304a\u4f7f\u3044\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u975e\u63a8\u5968\u30fb\u524a\u9664\u306a\u95a2\u6570\u3044\u307e\u305b\u3093\u304b\uff1f<\/h2>\n<p>\u73fe\u5728\u7a3c\u50cd\u4e2d\u306e\u30b7\u30b9\u30c6\u30e0\u306e\u4e2d\u306b\u300csplit\u300d\u95a2\u6570\u304c\u3001\u7d76\u8cdb\u5206\u5272\u4e2d\u3068\u3044\u3046\u65b9\u306f\u3044\u3089\u3063\u3057\u3083\u3044\u307e\u305b\u3093\u304b\uff1f<\/p>\n<p>\u4eca\u66f4\u306a\u304c\u3089\u3067\u306f\u3042\u308a\u307e\u3059\u304c\u3001\u300csplit\u300d\u95a2\u6570\u306f\u3001PHP5.3.0\u3067\u975e\u63a8\u5968\u306b\u306a\u308a\u3001\u53bb\u5e74\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u305fPHP7\u3067\u306f\u524a\u9664\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u300csplit\u300d\u95a2\u6570\u304c\u7a3c\u50cd\u4e2d\u306e\u30b7\u30b9\u30c6\u30e0\u3092PHP7\u306b\u79fb\u884c\u3057\u3066\u3057\u307e\u3046\u3068\u300ccall to undefined function split()\u300d\u306e\u30a8\u30e9\u30fc\u306e\u5d50\u306b\u5dfb\u304d\u8fbc\u307e\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u306e\u3067\u3001\u79fb\u7ba1\u306f\u5341\u5206\u306b\u3054\u6ce8\u610f\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>PHP\u521d\u5fc3\u8005\u3042\u308b\u3042\u308b\u3067\u3059\u304c\u3001Google\u5148\u751f\u306b\u300cPHP \u5206\u5272\u300d\u306a\u3069\u3067\u8abf\u3079\u3066\u53e4\u3044\u8a18\u4e8b\u306b\u3001\u3055\u3089\u3063\u3068\u300csplit\u300d\u95a2\u6570\u304c\u5229\u7528\u3055\u308c\u3066\u3044\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u30bd\u30fc\u30b9\u304c\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u9593\u9055\u3063\u3066\u7206\u5f3e\u4ed8\u304d\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u30b3\u30d4\u30fc\uff06\u30da\u30fc\u30b9\u30c8\u3057\u3066\u6642\u9593\u306e\u6d6a\u8cbb\u3092\u3057\u306a\u3044\u3088\u3046\u306b\u3054\u6ce8\u610f\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2>\u6b63\u898f\u8868\u73fe\u5acc\u3044\u306e\u65b9\u306b\u304a\u3059\u3059\u3081\u306a\u5206\u5272\u95a2\u6570<\/h2>\n<p>\u307e\u305a\u306f\u300c\u6b63\u898f\u8868\u73fe\u300d\u3068\u3044\u3046\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u805e\u3044\u3066\u300c\u3046\u3052\u3047\u300d\u3068\u53cd\u5c04\u7684\u306b\u6f0f\u3089\u3057\u3066\u3057\u307e\u3063\u305f\u65b9\u306f\u3044\u307e\u305b\u3093\u304b\uff1f<\/p>\n<p>\u5206\u5272\u95a2\u6570\u306e\u4e2d\u306b\u300cpreg_split\u300d\u95a2\u6570\u3068\u3044\u3046\u3001\u6b63\u898f\u8868\u73fe\u3092\u4f7f\u7528\u3057\u3066\u6587\u5b57\u5217\u3092\u5206\u5272\u3059\u308b\u3068\u3044\u3046\u95a2\u6570\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u300cpreg_split\u300d\u95a2\u6570\u306f\u3001\u7b2c\uff11\u5f15\u6570\u306b\u6b63\u898f\u8868\u73fe\u306b\u3088\u308b\u30de\u30c3\u30c1\u30d1\u30bf\u30fc\u30f3\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001\u6587\u5b57\u5217\u3092\u5206\u5272\u3057\u305f\u914d\u5217\u3092\u8fd4\u3057\u3066\u304f\u308c\u308b\u4fbf\u5229\u306a\u95a2\u6570\u3067\u3059\u3002<\/p>\n<p>\u25a0\u300cpreg_split\u300d\u95a2\u6570\u3092\u4f7f\u3063\u305f\u5206\u5272\u65b9\u6cd5\u4f8b<\/p>\n<pre class=\"lang:php decode:true \" >&lt;?php\r\n$iataCode = \"KIX,HND,NRT,ITM\";\r\n$iataList = preg_split(\"\/,\/\", $iataCode);\r\n\r\nvar_dump($iataList);<\/pre>\n<p>\u25a0\u51fa\u529b\u7d50\u679c<\/p>\n<pre class=\"lang:default decode:true \" >array(4) { [0]=&gt; string(3) \"KIX\" [1]=&gt; string(3) \"HND\" [2]=&gt; string(3) \"NRT\" [3]=&gt; string(3) \"ITM\" }<\/pre>\n<p>CSV\u306a\u3069\u3067\u3088\u304f\u898b\u304b\u3051\u308b\u300c\u30ab\u30f3\u30de\u533a\u5207\u308a\u300d\u306e\u5206\u5272\u3092\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u305f\u3060\u3001\u6b63\u898f\u8868\u73fe\u3092\u4f7f\u3044\u307e\u3057\u305f\u304c\u300c\u30ab\u30f3\u30de\u533a\u5207\u308a\u300d\u306a\u3069\u306e\u7c21\u5358\u306a\u5206\u5272\u306b\u6b63\u898f\u8868\u73fe\u3092\u5229\u7528\u3059\u308b\u3068\u3044\u3046\u306e\u306f\u4f55\u3060\u304b\u5927\u3052\u3055\u306a\u6c17\u304c\u3059\u308b\u306e\u306f\u79c1\u3060\u3051\u3067\u3057\u3087\u3046\u304b\uff1f\uff1f<\/p>\n<p>\u3053\u306e\u3088\u3046\u306a\u5358\u7d14\u306a\u6761\u4ef6\u3067\u6587\u5b57\u5217\u306e\u5206\u5272\u3092\u3059\u308b\u5834\u5408\u306f\u3001\u300c\u304a\u624b\u8efd\uff0b\u6b63\u898f\u8868\u73fe\u306a\u3057\u300d\u3067\u4f7f\u3048\u308b\u300cexplode\u300d\u95a2\u6570\u3092\u5229\u7528\u3059\u308b\u306e\u304c\u826f\u3044\u3067\u3059\u3002<\/p>\n<p>\u5148\u7a0b\u306e\u4f8b\u3092\u300cexplode\u300d\u95a2\u6570\u3092\u4f7f\u3063\u3066\u518d\u73fe\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u25a0\u300cexplode\u300d\u95a2\u6570\u3092\u4f7f\u3063\u305f\u5206\u5272\u65b9\u6cd5\u4f8b<\/p>\n<pre class=\"lang:php decode:true \" >&lt;?php\r\n$iataCode = \"KIX,HND,NRT,ITM\";\r\n$iataList = explode(\",\", $iataCode);\r\n\r\nvar_dump($iataList);<\/pre>\n<p>\u25a0\u51fa\u529b\u7d50\u679c<\/p>\n<pre class=\"lang:default decode:true \" >array(4) { [0]=&gt; string(3) \"KIX\" [1]=&gt; string(3) \"HND\" [2]=&gt; string(3) \"NRT\" [3]=&gt; string(3) \"ITM\" }<\/pre>\n<p>\u3071\u3063\u3068\u898b\u305f\u611f\u3058\u3067\u306f\u3042\u307e\u308a\u5909\u308f\u3063\u3066\u3044\u307e\u305b\u3093\u304c\u3001\u300c\u6b63\u898f\u8868\u73fe\u3092\u6c17\u306b\u3057\u306a\u304f\u3066\u3044\u3044\u300d\u3068\u3044\u3046\u306e\u306f\u3001\u6b63\u898f\u8868\u73fe\u30a2\u30ec\u30eb\u30ae\u30fc\u6c17\u5473\u306e\u65b9\u306b\u306f\u6717\u5831\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\uff1f\uff1f<\/p>\n<p>\u307e\u305f\u3001\u300cpreg_split\u300d\u95a2\u6570\u306f\u6b63\u898f\u8868\u73fe\u51e6\u7406\u3092\u884c\u3046\u5206\u3001\u6b63\u898f\u8868\u73fe\u3092\u5229\u7528\u3057\u306a\u3044\u300cexplode\u300d\u95a2\u6570\u306e\u65b9\u304c\u901f\u3044\u3068\u3044\u3046\u7279\u5fb4\u3082\u3042\u308a\u307e\u3059\u3002<br \/>\n\u203b\u77ed\u3044\u6587\u5b57\u5217\u306e\u5206\u5272\u3067\u306f\u3001\u76ee\u306b\u898b\u3048\u3066\u306e\u901f\u5ea6\u306e\u9055\u3044\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>PHP\u306e\u5206\u5272\u51e6\u7406\u306f\u3001\u5229\u7528\u3059\u308b\u983b\u5ea6\u304c\u9ad8\u3044\u51e6\u7406\u306e\uff11\u3064\u3067\u3059\u3002<\/p>\n<p>\u3053\u3046\u3044\u3063\u305f\u4f7f\u7528\u983b\u5ea6\u306e\u9ad8\u3044\u95a2\u6570\u3067\u982d\u3092\u60a9\u307e\u3059\u306e\u306f\u52b9\u7387\u3082\u3088\u304f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\uff11\u3064\u306e\u8003\u3048\u65b9\u3068\u3057\u3066\u300c\u6b63\u898f\u8868\u73fe\u3042\u308a\u5206\u5272\uff1dpreg_split\u300d\u300c\u6b63\u898f\u8868\u73fe\u306a\u3057\u5206\u5272\uff1dexplode\u300d\u3068\u3057\u3066\u4f7f\u3044\u5206\u3051\u308b\u3068\u30d7\u30ed\u30b0\u30e9\u30e0\u30bd\u30fc\u30b9\u3082\u5206\u304b\u308a\u3084\u3059\u304f\u3001\u52b9\u7387\u826f\u304f\u66f8\u3051\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u6b21\u56de\u306f\u3001\u300c\u300e\u5206\u5272\u300f\u306e\u3042\u3068\u306f\u300e\u7d50\u5408\u300f\u3067\u3057\u3087\uff01\u300d\u3068\u3044\u3046\u3053\u3068\u3067\u914d\u5217\u306e\u7d50\u5408\u306e\u3054\u7d39\u4ecb\u3092\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u3088\u3044\u30af\u30ea\u30b9\u30de\u30b9\u3092\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u3070\u3093\u306f\u3001Web\u30d7\u30ed\u30b0\u30e9\u30de\u306e\u7be0\u7530\u3067\u3059\u3002 \u3042\u3068\u300110\u56de\u307b\u3069\u5bdd\u308b\u3068\u304a\u6b63&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":1317,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1751"}],"collection":[{"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1751"}],"version-history":[{"count":5,"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1751\/revisions"}],"predecessor-version":[{"id":1756,"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1751\/revisions\/1756"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/media\/1317"}],"wp:attachment":[{"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1751"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1751"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}