{"id":3683,"date":"2025-04-11T11:54:16","date_gmt":"2025-04-11T02:54:16","guid":{"rendered":"https:\/\/dexall.co.jp\/articles\/?p=3683"},"modified":"2025-04-11T11:54:18","modified_gmt":"2025-04-11T02:54:18","slug":"%e3%80%90php%e3%80%91%e6%96%87%e5%ad%97%e5%88%97%e5%88%86%e5%89%b2%e3%81%ae%e6%b1%ba%e5%ae%9a%e7%89%88%ef%bc%81explode%e3%83%bbstr_split%e3%83%bbpreg_split%e3%81%ae%e4%bd%bf%e3%81%84%e5%88%86%e3%81%91","status":"publish","type":"post","link":"https:\/\/dexall.co.jp\/articles\/?p=3683","title":{"rendered":"\u3010PHP\u3011\u6587\u5b57\u5217\u5206\u5272\u306e\u6c7a\u5b9a\u7248\uff01explode\u30fbstr_split\u30fbpreg_split\u306e\u4f7f\u3044\u5206\u3051\u3068\u5b9f\u8df5\u4f8b10\u9078"},"content":{"rendered":"\n<div class=\"toc\"><br \/>\n<b>Warning<\/b>:  Undefined array key \"is_admin\" in <b>\/home\/xs392991\/dexall.co.jp\/public_html\/articles\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>116<\/b><br \/>\n<br \/>\n<b>Warning<\/b>:  Undefined array key \"is_category_top\" in <b>\/home\/xs392991\/dexall.co.jp\/public_html\/articles\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>121<\/b><br \/>\n<br \/>\n<b>Warning<\/b>:  Undefined array key \"is_top\" in <b>\/home\/xs392991\/dexall.co.jp\/public_html\/articles\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>128<\/b><br \/>\n    <div id=\"toc_container\" class=\"sgb-toc--bullets js-smooth-scroll\" data-dialog-title=\"\u76ee\u6b21\">\n      <p class=\"toc_title\">\u76ee\u6b21 <\/p>\n      <ul class=\"toc_list\">  <li class=\"first\">    <a href=\"#i-0\">PHP\u3067\u306e\u6587\u5b57\u5217\u5206\u5272\u306e\u57fa\u672c\u3068\u91cd\u8981\u6027<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-1\">\u6587\u5b57\u5217\u64cd\u4f5c\u304cPHP\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3067\u679c\u305f\u3059\u4e0d\u53ef\u6b20\u306a\u5f79\u5272<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-2\">\u52b9\u7387\u7684\u306a\u6587\u5b57\u5217\u5206\u5272\u304c\u958b\u767a\u901f\u5ea6\u3068\u51e6\u7406\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306b\u4e0e\u3048\u308b\u5f71\u97ff<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-7\">PHP\u306e\u6587\u5b57\u5217\u5206\u5272\u95a2\u6570\u306e\u6bd4\u8f03<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-8\">\u6587\u5b57\u5217\u5206\u5272\u95a2\u6570\u306e\u9055\u3044\u3092\u4e00\u76ee\u3067\u7406\u89e3\u3067\u304d\u308b\u6bd4\u8f03\u8868<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-9\">\u305d\u308c\u305e\u308c\u306e\u95a2\u6570\u3092\u9078\u3076\u3079\u304d\u5177\u4f53\u7684\u306a\u30b1\u30fc\u30b9<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-15\">explode()\u95a2\u6570\u306e\u5fb9\u5e95\u89e3\u8aac<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-16\">\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\u3068\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u8aac\u660e<\/a>      <\/li>      <li>        <a href=\"#i-17\">\u6587\u5b57\u5217\u3092\u914d\u5217\u306b\u5909\u63db\u3059\u308b\u969b\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-21\">limit\u5f15\u6570\u3092\u6d3b\u7528\u3057\u305f\u5206\u5272\u5236\u5fa1\u30c6\u30af\u30cb\u30c3\u30af<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-26\">str_split()\u95a2\u6570\u306e\u30de\u30b9\u30bf\u30fc\u30ac\u30a4\u30c9<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-27\">\u56fa\u5b9a\u9577\u3067\u306e\u6587\u5b57\u5217\u5206\u5272\u306e\u4ed5\u7d44\u307f\u3068\u30b3\u30fc\u30c9\u30b5\u30f3\u30d7\u30eb<\/a>      <\/li>      <li>        <a href=\"#i-28\">\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u5217\u3092\u6271\u3046\u969b\u306e\u6ce8\u610f\u70b9\u3068\u5bfe\u7b56<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-32\">explode()\u3068\u306e\u4f7f\u3044\u5206\u3051\u306b\u304a\u3051\u308b\u6c7a\u5b9a\u7684\u306a\u5dee\u7570<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-33\">preg_split()\u3067\u5b9f\u73fe\u3059\u308b\u9ad8\u5ea6\u306a\u6587\u5b57\u5217\u5206\u5272<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-34\">\u6b63\u898f\u8868\u73fe\u3092\u6d3b\u7528\u3057\u305f\u67d4\u8edf\u306a\u5206\u5272\u30d1\u30bf\u30fc\u30f3\u8a2d\u8a08<\/a>      <\/li>      <li>        <a href=\"#i-40\">\u30d5\u30e9\u30b0\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u99c6\u4f7f\u3057\u305f\u5206\u5272\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-45\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u8003\u616e\u3057\u305f\u6b63\u898f\u8868\u73fe\u30d1\u30bf\u30fc\u30f3\u306e\u6700\u9069\u5316<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-51\">PHP 8.0\u4ee5\u964d\u306e\u65b0\u6a5f\u80fd\u3068\u6587\u5b57\u5217\u5206\u5272<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-52\">PHP 8.0\u3067\u5c0e\u5165\u3055\u308c\u305f\u6587\u5b57\u5217\u95a2\u9023\u306e\u65b0\u6a5f\u80fd<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-56\">\u5f93\u6765\u306e\u5206\u5272\u65b9\u6cd5\u3068\u6bd4\u8f03\u3057\u305f\u6a5f\u80fd\u5f37\u5316\u30dd\u30a4\u30f3\u30c8<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-60\">\u6587\u5b57\u5217\u5206\u5272\u306e\u5b9f\u8df5\u7684\u306a\u5fdc\u7528\u4f8b<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-61\">CSV\u30c7\u30fc\u30bf\u51e6\u7406\u306b\u304a\u3051\u308b\u52b9\u7387\u7684\u306a\u5206\u5272\u30c6\u30af\u30cb\u30c3\u30af<\/a>      <\/li>      <li>        <a href=\"#i-66\">JSON\u3084XML\u69cb\u9020\u304b\u3089\u306e\u7279\u5b9a\u30c7\u30fc\u30bf\u62bd\u51fa\u6cd5<\/a>      <\/li>      <li>        <a href=\"#i-70\">\u30d5\u30a9\u30fc\u30e0\u30c7\u30fc\u30bf\u306e\u51e6\u7406\u3068\u691c\u8a3c\u306b\u304a\u3051\u308b\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-73\">\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u89e3\u6790\u306b\u304a\u3051\u308b\u6587\u5b57\u5217\u5206\u5272\u306e\u6d3b\u7528\u6cd5<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-76\">\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\uff08\u65e5\u672c\u8a9e\u306a\u3069\uff09\u3092\u6271\u3046\u969b\u306e\u6587\u5b57\u5217\u5206\u5272<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-77\">mb_split()\u95a2\u6570\u3092\u7528\u3044\u305f\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u5bfe\u5fdc\u5206\u5272\u624b\u6cd5<\/a>      <\/li>      <li>        <a href=\"#i-78\">\u6587\u5b57\u5316\u3051\u3092\u9632\u3050\u305f\u3081\u306e\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u8a2d\u5b9a<\/a>      <\/li>      <li>        <a href=\"#i-83\">UTF-8\u74b0\u5883\u3067\u306e\u6587\u5b57\u5217\u5206\u5272\u306b\u304a\u3051\u308b\u6ce8\u610f\u70b9<\/a>      <\/li>      <li>        <a href=\"#i-88\">\u6587\u5b57\u5316\u3051\u3092\u9632\u3050\u305f\u3081\u306e\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u8a2d\u5b9a<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-92\">UTF-8\u74b0\u5883\u3067\u306e\u6587\u5b57\u5217\u5206\u5272\u306b\u304a\u3051\u308b\u6ce8\u610f\u70b9<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-96\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u8003\u616e\u3057\u305f\u6587\u5b57\u5217\u5206\u5272\u306e\u6700\u9069\u5316<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-97\">\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3092\u6291\u3048\u305f\u5927\u91cf\u30c6\u30ad\u30b9\u30c8\u306e\u5206\u5272\u624b\u6cd5<\/a>      <\/li>      <li>        <a href=\"#i-101\">\u30d9\u30f3\u30c1\u30de\u30fc\u30af\u3067\u898b\u308b\u5404\u5206\u5272\u95a2\u6570\u306e\u51e6\u7406\u901f\u5ea6\u6bd4\u8f03<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-102\">\u9ad8\u8ca0\u8377\u74b0\u5883\u3067\u306e\u6587\u5b57\u5217\u51e6\u7406\u306e\u6700\u9069\u5316\u6226\u7565<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-106\">\u3088\u304f\u3042\u308b\u30a8\u30e9\u30fc\u3068\u305d\u306e\u89e3\u6c7a\u6cd5<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-107\">\u300cWarning: explode() expects parameter\u2026\u300d\u30a8\u30e9\u30fc\u306e\u539f\u56e0\u3068\u5bfe\u51e6\u6cd5<\/a>      <\/li>      <li>        <a href=\"#i-111\">\u7a7a\u6587\u5b57\u5217\u3067\u306esplit\u304c\u5f15\u304d\u8d77\u3053\u3059\u554f\u984c\u3068\u56de\u907f\u7b56<\/a>      <\/li>      <li>        <a href=\"#i-114\">\u7279\u6b8a\u6587\u5b57\u3084\u30a8\u30b9\u30b1\u30fc\u30d7\u30b7\u30fc\u30b1\u30f3\u30b9\u304c\u7d61\u3080\u5206\u5272\u306e\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-119\">\u4e00\u822c\u7684\u306a\u30c7\u30d0\u30c3\u30b0\u3068\u4e88\u9632\u7b56<\/a>      <\/li>    <\/ul>  <\/li>  <li class=\"last\">    <a href=\"#i-123\">\u307e\u3068\u3081\uff1a\u72b6\u6cc1\u5225\u30fb\u6700\u9069\u306a\u6587\u5b57\u5217\u5206\u5272\u65b9\u6cd5\u306e\u9078\u629e\u30d5\u30ed\u30fc\u30c1\u30e3\u30fc\u30c8<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-124\">\u5206\u5272\u3057\u305f\u3044\u5185\u5bb9\u306b\u5fdc\u3058\u305f\u95a2\u6570\u9078\u629e\u306e\u610f\u601d\u6c7a\u5b9a\u30d7\u30ed\u30bb\u30b9<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-125\">\u5b66\u7fd2\u3057\u305f\u30c6\u30af\u30cb\u30c3\u30af\u306e\u5b9f\u52d9\u3078\u306e\u5fdc\u7528\u30dd\u30a4\u30f3\u30c8<\/a>      <\/li>    <\/ul>  <\/li><\/ul>\n      <a href=\"#\" class=\"sgb-toc-button js-toc-button\" rel=\"nofollow\" data-open-dialog=\"true\"><i class=\"fa fa-list\"><\/i><span class=\"sgb-toc-button__text\">\u76ee\u6b21\u3078<\/span><\/a>\n    <\/div><\/div><h2 class=\"wp-block-heading\" id=\"i-0\">PHP\u3067\u306e\u6587\u5b57\u5217\u5206\u5272\u306e\u57fa\u672c\u3068\u91cd\u8981\u6027<\/h2>\n\n\n\n<p>Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306b\u304a\u3044\u3066\u3001\u6587\u5b57\u5217\u64cd\u4f5c\u306f\u6700\u3082\u983b\u7e41\u306b\u884c\u308f\u308c\u308b\u51e6\u7406\u306e\u4e00\u3064\u3067\u3059\u3002\u7279\u306b\u6587\u5b57\u5217\u5206\u5272\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u306e\u51e6\u7406\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304b\u3089\u306e\u53d6\u5f97\u30c7\u30fc\u30bf\u306e\u52a0\u5de5\u3001API\u30ec\u30b9\u30dd\u30f3\u30b9\u306e\u89e3\u6790\u306a\u3069\u3001\u3042\u3089\u3086\u308b\u5834\u9762\u3067\u5fc5\u8981\u3068\u306a\u308b\u30b9\u30ad\u30eb\u3067\u3059\u3002PHP\u306b\u306f\u8907\u6570\u306e\u6587\u5b57\u5217\u5206\u5272\u95a2\u6570\u304c\u7528\u610f\u3055\u308c\u3066\u304a\u308a\u3001\u72b6\u6cc1\u306b\u5fdc\u3058\u3066\u9069\u5207\u306a\u95a2\u6570\u3092\u9078\u629e\u3059\u308b\u3053\u3068\u3067\u3001\u52b9\u7387\u7684\u304b\u3064\u5805\u7262\u306a\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-1\">\u6587\u5b57\u5217\u64cd\u4f5c\u304cPHP\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3067\u679c\u305f\u3059\u4e0d\u53ef\u6b20\u306a\u5f79\u5272<\/h3>\n\n\n\n<p>PHP\u306f\u5143\u3005\u300cPersonal Home Page\u300d\u306e\u7565\u79f0\u3067\u3057\u305f\u304c\u3001\u73fe\u5728\u306f\u300cPHP: Hypertext Preprocessor\u300d\u306e\u518d\u5e30\u7684\u982d\u5b57\u8a9e\u3068\u3057\u3066\u77e5\u3089\u308c\u3066\u3044\u307e\u3059\u3002\u305d\u306e\u540d\u524d\u304c\u793a\u3059\u901a\u308a\u3001PHP\u306fWeb\u30da\u30fc\u30b8\u306e\u751f\u6210\u306b\u7279\u5316\u3057\u3066\u304a\u308a\u3001\u6587\u5b57\u5217\u51e6\u7406\u304c\u305d\u306e\u4e2d\u6838\u3092\u62c5\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u72b6\u6cc1\u3067\u6587\u5b57\u5217\u64cd\u4f5c\u306f\u4e0d\u53ef\u6b20\u3067\u3059\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u306e\u691c\u8a3c\u3068\u6574\u5f62<\/strong><br>\u30d5\u30a9\u30fc\u30e0\u304b\u3089\u9001\u4fe1\u3055\u308c\u305f\u30c7\u30fc\u30bf\u3092\u5206\u5272\u3001\u691c\u8a3c\u3001\u30b5\u30cb\u30bf\u30a4\u30ba\u3059\u308b\u51e6\u7406<\/li>\n\n\n\n<li><strong>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u64cd\u4f5c<\/strong><br>\u30af\u30a8\u30ea\u7d50\u679c\u306e\u51e6\u7406\u3001\u30c7\u30fc\u30bf\u306e\u6574\u5f62\u3001\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u5909\u63db<\/li>\n\n\n\n<li><strong>\u30d5\u30a1\u30a4\u30eb\u64cd\u4f5c<\/strong><br>CSV\u30d5\u30a1\u30a4\u30eb\u306e\u8aad\u307f\u8fbc\u307f\u3001\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30fc\u30b9\u3001\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u306e\u89e3\u6790<\/li>\n\n\n\n<li><strong>API\u901a\u4fe1<\/strong><br>JSON\u3084XML\u30c7\u30fc\u30bf\u306e\u89e3\u6790\u3001\u30ec\u30b9\u30dd\u30f3\u30b9\u306e\u51e6\u7406<\/li>\n\n\n\n<li><strong>\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30a8\u30f3\u30b8\u30f3<\/strong><br>\u52d5\u7684\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u751f\u6210\u3001\u30ec\u30a4\u30a2\u30a6\u30c8\u51e6\u7406<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ PHP\u3067\u3088\u304f\u3042\u308b\u6587\u5b57\u5217\u64cd\u4f5c\u306e\u4f8b\n$userInput = \"John,Doe,john.doe@example.com,35\";\n\n\/\/ \u6587\u5b57\u5217\u5206\u5272\u3067\u30e6\u30fc\u30b6\u30fc\u60c5\u5831\u3092\u53d6\u5f97\n$userData = explode(',', $userInput);\nlist($firstName, $lastName, $email, $age) = $userData;\n\n\/\/ \u5e74\u9f62\u306e\u691c\u8a3c\nif (is_numeric($age) &amp;&amp; $age &gt;= 18) {\n    echo \"\u3088\u3046\u3053\u305d\u3001$firstName $lastName \u3055\u3093\uff01\";\n} else {\n    echo \"\u30a2\u30af\u30bb\u30b9\u306b\u306f18\u6b73\u4ee5\u4e0a\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\";\n}\n<\/pre>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306b\u3001\u6587\u5b57\u5217\u5206\u5272\u306f\u5358\u7d14\u306a\u64cd\u4f5c\u306b\u898b\u3048\u3066\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u6a5f\u80fd\u6027\u3068\u5b89\u5168\u6027\u3092\u652f\u3048\u308b\u91cd\u8981\u306a\u5f79\u5272\u3092\u679c\u305f\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-2\">\u52b9\u7387\u7684\u306a\u6587\u5b57\u5217\u5206\u5272\u304c\u958b\u767a\u901f\u5ea6\u3068\u51e6\u7406\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306b\u4e0e\u3048\u308b\u5f71\u97ff<\/h3>\n\n\n\n<p>\u9069\u5207\u306a\u6587\u5b57\u5217\u5206\u5272\u95a2\u6570\u306e\u9078\u629e\u3068\u4f7f\u7528\u306f\u3001\u4ee5\u4e0b\u306e\u70b9\u3067\u5927\u304d\u306a\u5f71\u97ff\u3092\u4e0e\u3048\u307e\u3059\uff1a<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-3\">1. \u958b\u767a\u52b9\u7387\u306e\u5411\u4e0a<\/h4>\n\n\n\n<p>\u9069\u5207\u306a\u6587\u5b57\u5217\u5206\u5272\u95a2\u6570\u3092\u77e5\u3063\u3066\u3044\u308c\u3070\u3001\u8907\u96d1\u306a\u51e6\u7406\u3082\u7c21\u6f54\u306b\u8a18\u8ff0\u3067\u304d\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u6b63\u898f\u8868\u73fe\u3092\u4f7f\u3063\u305f\u8907\u96d1\u306a\u5206\u5272\u30d1\u30bf\u30fc\u30f3\u3082\u3001<code>preg_split()<\/code>\u95a2\u6570\u3092\u4f7f\u3048\u30701\u884c\u3067\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u8907\u6570\u306e\u533a\u5207\u308a\u6587\u5b57\uff08\u30ab\u30f3\u30de\u3001\u30bb\u30df\u30b3\u30ed\u30f3\u3001\u30bf\u30d6\uff09\u3067\u5206\u5272\u3059\u308b\u4f8b\n$data = \"item1,item2;item3\\titem4\";\n\n\/\/ \u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u3067\u30821\u884c\u3067\u5b9f\u88c5\u53ef\u80fd\n$items = preg_split('\/[,;\\t]\/', $data);\n\/\/ \u7d50\u679c: [\"item1\", \"item2\", \"item3\", \"item4\"]\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-4\">2. \u30b3\u30fc\u30c9\u306e\u53ef\u8aad\u6027\u30fb\u4fdd\u5b88\u6027\u306e\u5411\u4e0a<\/h4>\n\n\n\n<p>\u76ee\u7684\u306b\u5408\u3063\u305f\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30b3\u30fc\u30c9\u306e\u610f\u56f3\u304c\u660e\u78ba\u306b\u306a\u308a\u3001\u4ed6\u306e\u958b\u767a\u8005\u306b\u3068\u3063\u3066\u3082\u7406\u89e3\u3057\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u4e0d\u9069\u5207\u306a\u4f8b\uff08\u7121\u7406\u3084\u308aexplode\u3092\u4f7f\u7528\uff09\n$text = \"Hello World\";\n$chars = explode('', trim($text));  \/\/ \u30a8\u30e9\u30fc: Empty delimiter\n\n\/\/ \u9069\u5207\u306a\u4f8b\uff08\u76ee\u7684\u306b\u3042\u3063\u305f\u95a2\u6570\u3092\u4f7f\u7528\uff09\n$chars = str_split($text);  \/\/ [\"H\", \"e\", \"l\", \"l\", \"o\", \" \", \"W\", \"o\", \"r\", \"l\", \"d\"]\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-5\">3. \u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306e\u6700\u9069\u5316<\/h4>\n\n\n\n<p>\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u51e6\u7406\u3059\u308b\u5834\u5408\u3001\u9069\u5207\u306a\u95a2\u6570\u9078\u629e\u306f\u51e6\u7406\u901f\u5ea6\u3068\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u306b\u76f4\u7d50\u3057\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u5358\u7d14\u306a\u533a\u5207\u308a\u6587\u5b57\u3067\u306e\u5206\u5272\u306a\u3089<code>explode()<\/code>\u304c\u6700\u3082\u9ad8\u901f\u3067\u3001\u6b63\u898f\u8868\u73fe\u306b\u3088\u308b\u8907\u96d1\u306a\u5206\u5272\u30d1\u30bf\u30fc\u30f3\u304c\u5fc5\u8981\u306a\u5834\u5408\u306e\u307f<code>preg_split()<\/code>\u3092\u4f7f\u3046\u3068\u3044\u3063\u305f\u5224\u65ad\u304c\u91cd\u8981\u3067\u3059\u3002<\/p>\n\n\n<div id=\"id-044010db-b418-4878-a5b7-5b04d3d70773\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u95a2\u6570\u540d<\/th><th>\u76f8\u5bfe\u7684\u306a\u51e6\u7406\u901f\u5ea6<\/th><th>\u30e1\u30e2\u30ea\u52b9\u7387<\/th><th>\u7528\u9014<\/th><\/tr><\/thead><tbody><tr><td>explode()<\/td><td>\u975e\u5e38\u306b\u9ad8\u901f<\/td><td>\u826f\u597d<\/td><td>\u5358\u7d14\u306a\u533a\u5207\u308a\u6587\u5b57\u306b\u3088\u308b\u5206\u5272<\/td><\/tr><tr><td>str_split()<\/td><td>\u9ad8\u901f<\/td><td>\u826f\u597d<\/td><td>\u56fa\u5b9a\u9577\u3067\u306e\u5206\u5272<\/td><\/tr><tr><td>preg_split()<\/td><td>\u3084\u3084\u9045\u3044<\/td><td>\u3084\u3084\u5927\u304d\u3044<\/td><td>\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u3067\u306e\u5206\u5272<\/td><\/tr><tr><td>mb_split()<\/td><td>\u9045\u3044<\/td><td>\u5927\u304d\u3044<\/td><td>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u542b\u3080\u5206\u5272<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<h4 class=\"wp-block-heading\" id=\"i-6\">4. \u30a8\u30e9\u30fc\u51e6\u7406\u306e\u52b9\u7387\u5316<\/h4>\n\n\n\n<p>\u9069\u5207\u306a\u95a2\u6570\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u30a8\u30c3\u30b8\u30b1\u30fc\u30b9\uff08\u7a7a\u6587\u5b57\u5217\u3001\u7279\u6b8a\u6587\u5b57\u306a\u3069\uff09\u306e\u51e6\u7406\u3082\u7c21\u6f54\u306b\u8a18\u8ff0\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30d0\u30b0\u306e\u767a\u751f\u3092\u4e88\u9632\u3057\u3001\u30b3\u30fc\u30c9\u306e\u5805\u7262\u6027\u3092\u9ad8\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306b\u3001\u6587\u5b57\u5217\u5206\u5272\u95a2\u6570\u3092\u9069\u5207\u306b\u7406\u89e3\u3057\u6d3b\u7528\u3059\u308b\u3053\u3068\u306f\u3001PHP\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u57fa\u672c\u3067\u3042\u308a\u3001\u52b9\u7387\u7684\u306a\u958b\u767a\u3068\u9ad8\u54c1\u8cea\u306a\u30b3\u30fc\u30c9\u4f5c\u6210\u306e\u9375\u3068\u306a\u308a\u307e\u3059\u3002\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001PHP\u3067\u5229\u7528\u53ef\u80fd\u306a\u4e3b\u8981\u306a\u6587\u5b57\u5217\u5206\u5272\u95a2\u6570\u3092\u8a73\u3057\u304f\u6bd4\u8f03\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-7\">PHP\u306e\u6587\u5b57\u5217\u5206\u5272\u95a2\u6570\u306e\u6bd4\u8f03<\/h2>\n\n\n\n<p>PHP\u306f\u6587\u5b57\u5217\u64cd\u4f5c\u306e\u305f\u3081\u306e\u8c4a\u5bcc\u306a\u95a2\u6570\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u63d0\u4f9b\u3057\u3066\u304a\u308a\u3001\u7279\u306b\u6587\u5b57\u5217\u5206\u5272\u306b\u95a2\u3057\u3066\u306f\u69d8\u3005\u306a\u65b9\u6cd5\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u305d\u308c\u305e\u308c\u306e\u95a2\u6570\u306b\u306f\u56fa\u6709\u306e\u7279\u5fb4\u304c\u3042\u308a\u3001\u4f7f\u7528\u30b7\u30fc\u30f3\u306b\u3088\u3063\u3066\u6700\u9069\u306a\u9078\u629e\u304c\u7570\u306a\u308a\u307e\u3059\u3002\u3053\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u5404\u95a2\u6570\u306e\u7279\u5fb4\u3092\u6bd4\u8f03\u3057\u3001\u3069\u306e\u3088\u3046\u306a\u72b6\u6cc1\u3067\u3069\u306e\u95a2\u6570\u3092\u9078\u3076\u3079\u304d\u304b\u3092\u660e\u78ba\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-8\">\u6587\u5b57\u5217\u5206\u5272\u95a2\u6570\u306e\u9055\u3044\u3092\u4e00\u76ee\u3067\u7406\u89e3\u3067\u304d\u308b\u6bd4\u8f03\u8868<\/h3>\n\n\n\n<p>\u307e\u305a\u306f\u3001PHP\u306e\u4e3b\u8981\u306a\u6587\u5b57\u5217\u5206\u5272\u95a2\u6570\u306e\u7279\u5fb4\u3092\u6bd4\u8f03\u8868\u3067\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n<div id=\"id-21132e0b-2298-49d1-9002-34401deacdaa\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u95a2\u6570\u540d<\/th><th>\u4e3b\u306a\u7528\u9014<\/th><th>\u69cb\u6587<\/th><th>\u9577\u6240<\/th><th>\u77ed\u6240<\/th><th>PHP\u4e92\u63db\u6027<\/th><\/tr><\/thead><tbody><tr><td><code>explode()<\/code><\/td><td>\u6307\u5b9a\u3057\u305f\u533a\u5207\u308a\u6587\u5b57\u3067\u5206\u5272<\/td><td><code>explode(separator, string, [limit])<\/code><\/td><td>\u9ad8\u901f\u3001\u30b7\u30f3\u30d7\u30eb\u3001\u76f4\u611f\u7684<\/td><td>\u533a\u5207\u308a\u6587\u5b57\u306f\u56fa\u5b9a\u6587\u5b57\u5217\u306e\u307f\u3001\u7a7a\u306e\u533a\u5207\u308a\u6587\u5b57\u306f\u30a8\u30e9\u30fc<\/td><td>PHP 4\u4ee5\u964d<\/td><\/tr><tr><td><code>str_split()<\/code><\/td><td>\u56fa\u5b9a\u9577\u3067\u6587\u5b57\u5217\u3092\u5206\u5272<\/td><td><code>str_split(string, [length])<\/code><\/td><td>\u9ad8\u901f\u3001\u4e00\u5b9a\u306e\u9577\u3055\u3067\u5206\u5272<\/td><td>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u306b\u306f\u975e\u5bfe\u5fdc\u3001\u6587\u5b57\u304c\u5206\u65ad\u3055\u308c\u308b\u53ef\u80fd\u6027<\/td><td>PHP 5\u4ee5\u964d<\/td><\/tr><tr><td><code>preg_split()<\/code><\/td><td>\u6b63\u898f\u8868\u73fe\u30d1\u30bf\u30fc\u30f3\u3067\u5206\u5272<\/td><td><code>preg_split(pattern, string, [limit], [flags])<\/code><\/td><td>\u975e\u5e38\u306b\u67d4\u8edf\u3001\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u306b\u5bfe\u5fdc<\/td><td>\u6bd4\u8f03\u7684\u4f4e\u901f\u3001\u69cb\u6587\u304c\u8907\u96d1<\/td><td>PHP 4\u4ee5\u964d<\/td><\/tr><tr><td><code>mb_split()<\/code><\/td><td>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u5217\u3092\u6b63\u898f\u8868\u73fe\u3067\u5206\u5272<\/td><td><code>mb_split(pattern, string, [limit])<\/code><\/td><td>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u306b\u5bfe\u5fdc<\/td><td><code>preg_split()<\/code>\u3088\u308a\u6a5f\u80fd\u304c\u9650\u5b9a\u7684\u3001\u8981mb\u62e1\u5f35<\/td><td>PHP 4.2\u4ee5\u964d<\/td><\/tr><tr><td><code>strtok()<\/code><\/td><td>\u30c8\u30fc\u30af\u30f3\u306b\u3088\u308b\u9010\u6b21\u5206\u5272<\/td><td><code>strtok(string, token)<\/code> \u305d\u306e\u5f8c <code>strtok(token)<\/code><\/td><td>\u30e1\u30e2\u30ea\u52b9\u7387\u304c\u826f\u3044\u3001\u5927\u304d\u306a\u30d5\u30a1\u30a4\u30eb\u5411\u3051<\/td><td>\u4f7f\u7528\u6cd5\u304c\u7279\u6b8a\u3001\u5168\u8981\u7d20\u3092\u4e00\u5ea6\u306b\u53d6\u5f97\u4e0d\u53ef<\/td><td>PHP 4\u4ee5\u964d<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<p>\u5404\u95a2\u6570\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u7279\u6027\u3082\u91cd\u8981\u306a\u6bd4\u8f03\u30dd\u30a4\u30f3\u30c8\u3067\u3059\u3002\u4ee5\u4e0b\u306f\u3001100\u4e07\u56de\u306e\u64cd\u4f5c\u3092\u884c\u3063\u305f\u5834\u5408\u306e\u76f8\u5bfe\u7684\u306a\u51e6\u7406\u6642\u9593\u306e\u6982\u7b97\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u5404\u95a2\u6570\u306e\u51e6\u7406\u901f\u5ea6\u6bd4\u8f03\uff08\u76f8\u5bfe\u5024\uff09\n\/\/ \u5024\u304c\u5c0f\u3055\u3044\u307b\u3069\u9ad8\u901f\uff08explode()\u30921\u3068\u3057\u305f\u5834\u5408\uff09\n$performance = [\n    'explode()' =&gt; 1,      \/\/ \u6700\u901f\n    'str_split()' =&gt; 1.2,  \/\/ \u307b\u307c\u540c\u7b49\u306b\u9ad8\u901f\n    'strtok()' =&gt; 1.5,     \/\/ \u3084\u3084\u9045\u3044\n    'preg_split()' =&gt; 3,   \/\/ \u304b\u306a\u308a\u9045\u3044\n    'mb_split()' =&gt; 5      \/\/ \u6700\u3082\u9045\u3044\n];\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-9\">\u305d\u308c\u305e\u308c\u306e\u95a2\u6570\u3092\u9078\u3076\u3079\u304d\u5177\u4f53\u7684\u306a\u30b1\u30fc\u30b9<\/h3>\n\n\n\n<p>\u72b6\u6cc1\u306b\u5fdc\u3058\u305f\u6700\u9069\u306a\u95a2\u6570\u9078\u629e\u306e\u6307\u91dd\u3092\u5177\u4f53\u7684\u306a\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u3067\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-10\">1. <code>explode()<\/code> \u304c\u6700\u9069\u306a\u30b1\u30fc\u30b9<\/h4>\n\n\n\n<p><code>explode()<\/code> \u306f\u5358\u7d14\u306a\u533a\u5207\u308a\u6587\u5b57\u306b\u3088\u308b\u5206\u5272\u304c\u5fc5\u8981\u3067\u3001\u9ad8\u901f\u6027\u304c\u6c42\u3081\u3089\u308c\u308b\u5834\u5408\u306b\u6700\u9069\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ CSV\u30d5\u30a1\u30a4\u30eb\u306e\u5404\u884c\u3092\u51e6\u7406\u3059\u308b\n$csvLine = \"\u7530\u4e2d,28,\u6771\u4eac\u90fd,\u30a8\u30f3\u30b8\u30cb\u30a2\";\n$userData = explode(',', $csvLine);\n\/\/ \u7d50\u679c: [\"\u7530\u4e2d\", \"28\", \"\u6771\u4eac\u90fd\", \"\u30a8\u30f3\u30b8\u30cb\u30a2\"]\n\n\/\/ URL\u306e\u30af\u30a8\u30ea\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u5206\u89e3\u3059\u308b\n$queryString = \"name=value&amp;foo=bar\";\n$pairs = explode('&amp;', $queryString);\n\/\/ \u7d50\u679c: [\"name=value\", \"foo=bar\"]\n<\/pre>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5834\u5408\u306b\u9078\u3073\u307e\u3057\u3087\u3046\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5358\u4e00\u306e\u6587\u5b57\u3084\u6587\u5b57\u5217\u3067\u533a\u5207\u3089\u308c\u305f\u30c7\u30fc\u30bf\u306e\u51e6\u7406<\/li>\n\n\n\n<li>CSV\u30d5\u30a1\u30a4\u30eb\u306e\u884c\u306e\u5206\u5272<\/li>\n\n\n\n<li>\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306e\u5358\u7d14\u306a\u89e3\u6790<\/li>\n\n\n\n<li>\u9ad8\u983b\u5ea6\u3067\u5b9f\u884c\u3055\u308c\u308b\u51e6\u7406<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-11\">2. <code>str_split()<\/code> \u304c\u6700\u9069\u306a\u30b1\u30fc\u30b9<\/h4>\n\n\n\n<p><code>str_split()<\/code> \u306f\u6587\u5b57\u5217\u3092\u7b49\u3057\u3044\u9577\u3055\u306e\u30c1\u30e3\u30f3\u30af\u306b\u5206\u5272\u3059\u308b\u5834\u5408\u306b\u9069\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30af\u30ec\u30b8\u30c3\u30c8\u30ab\u30fc\u30c9\u756a\u53f7\u3092\u898b\u3084\u3059\u304f\u8868\u793a\u3059\u308b\n$cardNumber = \"1234567890123456\";\n$groups = str_split($cardNumber, 4);\n$formattedCard = implode(' ', $groups);\n\/\/ \u7d50\u679c: \"1234 5678 9012 3456\"\n\n\/\/ \u30d0\u30a4\u30ca\u30ea\u30c7\u30fc\u30bf\u309216\u9032\u6570\u3067\u8868\u793a\n$binaryData = file_get_contents('image.jpg');\n$bytes = str_split($binaryData, 1);\nforeach (array_slice($bytes, 0, 10) as $byte) {\n    echo bin2hex($byte) . ' ';\n}\n\/\/ \u7d50\u679c: \"ff d8 ff e0 00 10 4a 46 49 46 \"\n<\/pre>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5834\u5408\u306b\u9078\u3073\u307e\u3057\u3087\u3046\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u56fa\u5b9a\u9577\u306e\u30c7\u30fc\u30bf\u5206\u5272<\/li>\n\n\n\n<li>\u30c7\u30fc\u30bf\u306e\u30c1\u30e3\u30f3\u30af\u51e6\u7406<\/li>\n\n\n\n<li>\u5358\u4e00\u30d0\u30a4\u30c8\u6587\u5b57\u5217\u306e\u51e6\u7406<\/li>\n\n\n\n<li>\u30b7\u30f3\u30d7\u30eb\u306a\u6587\u5b57\u5217\u306e\u5206\u89e3<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-12\">3. <code>preg_split()<\/code> \u304c\u6700\u9069\u306a\u30b1\u30fc\u30b9<\/h4>\n\n\n\n<p><code>preg_split()<\/code> \u306f\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u3067\u306e\u5206\u5272\u3084\u3001\u8907\u6570\u306e\u533a\u5207\u308a\u6587\u5b57\u304c\u3042\u308b\u5834\u5408\u306b\u5a01\u529b\u3092\u767a\u63ee\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u8907\u6570\u306e\u533a\u5207\u308a\u6587\u5b57\uff08\u30b9\u30da\u30fc\u30b9\u3001\u30bf\u30d6\u3001\u30ab\u30f3\u30de\uff09\u3067\u5206\u5272\n$data = \"\u9805\u76ee1 \u9805\u76ee2\\t\u9805\u76ee3,\u9805\u76ee4\";\n$items = preg_split('\/[\\s,]+\/', $data);\n\/\/ \u7d50\u679c: [\"\u9805\u76ee1\", \"\u9805\u76ee2\", \"\u9805\u76ee3\", \"\u9805\u76ee4\"]\n\n\/\/ HTML\u30bf\u30b0\u3092\u524a\u9664\u3057\u3066\u7d14\u7c8b\u306a\u30c6\u30ad\u30b9\u30c8\u3092\u5358\u8a9e\u3054\u3068\u306b\u62bd\u51fa\n$html = \"&lt;p&gt;\u3053\u308c\u306f&lt;strong&gt;\u91cd\u8981\u306a&lt;\/strong&gt;\u304a\u77e5\u3089\u305b\u3067\u3059\u3002&lt;\/p&gt;\";\n$words = preg_split('\/\\s+\/', strip_tags($html));\n\/\/ \u7d50\u679c: [\"\u3053\u308c\u306f\", \"\u91cd\u8981\u306a\", \"\u304a\u77e5\u3089\u305b\u3067\u3059\u3002\"]\n<\/pre>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5834\u5408\u306b\u9078\u3073\u307e\u3057\u3087\u3046\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u8907\u6570\u306e\u533a\u5207\u308a\u6587\u5b57\u304c\u3042\u308b\u5834\u5408<\/li>\n\n\n\n<li>\u533a\u5207\u308a\u6587\u5b57\u304c\u53ef\u5909\u9577\u306e\u5834\u5408<\/li>\n\n\n\n<li>\u7279\u5b9a\u306e\u30d1\u30bf\u30fc\u30f3\u306b\u57fa\u3065\u3044\u3066\u5206\u5272\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u5834\u5408<\/li>\n\n\n\n<li>\u5206\u5272\u3068\u540c\u6642\u306b\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u3057\u305f\u3044\u5834\u5408<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-13\">4. <code>mb_split()<\/code> \u304c\u6700\u9069\u306a\u30b1\u30fc\u30b9<\/h4>\n\n\n\n<p><code>mb_split()<\/code> \u306f\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\uff08\u65e5\u672c\u8a9e\u3001\u4e2d\u56fd\u8a9e\u3001\u97d3\u56fd\u8a9e\u306a\u3069\uff09\u3092\u542b\u3080\u6587\u5b57\u5217\u3092\u51e6\u7406\u3059\u308b\u5834\u5408\u306b\u9069\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u65e5\u672c\u8a9e\u306e\u6587\u5b57\u5217\u3092\u53e5\u8aad\u70b9\u3067\u5206\u5272\n$text = \"\u3053\u3093\u306b\u3061\u306f\u3001\u4e16\u754c\uff01PHP\u306f\u7d20\u6674\u3089\u3057\u3044\u3002\";\n$sentences = mb_split('[\u3001\u3002\uff01]', $text);\n\/\/ \u7d50\u679c: [\"\u3053\u3093\u306b\u3061\u306f\", \"\u4e16\u754c\", \"PHP\u306f\u7d20\u6674\u3089\u3057\u3044\", \"\"]\n<\/pre>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5834\u5408\u306b\u9078\u3073\u307e\u3057\u3087\u3046\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u30bb\u30c3\u30c8\uff08UTF-8\u306a\u3069\uff09\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b<\/li>\n\n\n\n<li>\u65e5\u672c\u8a9e\u306a\u3069\u306e\u975e\u30e9\u30c6\u30f3\u6587\u5b57\u3092\u51e6\u7406\u3059\u308b<\/li>\n\n\n\n<li>\u6587\u5b57\u5316\u3051\u3092\u907f\u3051\u308b\u5fc5\u8981\u304c\u3042\u308b<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-14\">5. <code>strtok()<\/code> \u304c\u6700\u9069\u306a\u30b1\u30fc\u30b9<\/h4>\n\n\n\n<p><code>strtok()<\/code> \u306f\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3092\u6700\u5c0f\u9650\u306b\u6291\u3048\u3066\u5927\u304d\u306a\u30d5\u30a1\u30a4\u30eb\u3092\u51e6\u7406\u3059\u308b\u5834\u5408\u306b\u6709\u7528\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u5927\u304d\u306a\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u306e\u5404\u884c\u3092\u51e6\u7406\n$logFile = fopen(\"large_log.txt\", \"r\");\nif ($logFile) {\n    while (($line = fgets($logFile)) !== false) {\n        $token = strtok($line, \" \\t\");\n        $timestamp = $token;\n        \n        $token = strtok(\" \\t\");\n        $level = $token;\n        \n        \/\/ \u6b8b\u308a\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u90e8\u5206\u3092\u53d6\u5f97\n        $message = trim(substr($line, strpos($line, $level) + strlen($level)));\n        \n        \/\/ \u51e6\u7406...\n    }\n    fclose($logFile);\n}\n<\/pre>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5834\u5408\u306b\u9078\u3073\u307e\u3057\u3087\u3046\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u975e\u5e38\u306b\u5927\u304d\u306a\u30d5\u30a1\u30a4\u30eb\u3092\u51e6\u7406\u3059\u308b<\/li>\n\n\n\n<li>\u30e1\u30e2\u30ea\u52b9\u7387\u304c\u91cd\u8981<\/li>\n\n\n\n<li>\u6587\u5b57\u5217\u306e\u4e00\u90e8\u3060\u3051\u3092\u9806\u6b21\u51e6\u7406\u3059\u308b<\/li>\n<\/ul>\n\n\n\n<p>\u9069\u5207\u306a\u6587\u5b57\u5217\u5206\u5272\u95a2\u6570\u306e\u9078\u629e\u306f\u3001\u30b3\u30fc\u30c9\u306e\u52b9\u7387\u6027\u3001\u53ef\u8aad\u6027\u3001\u4fdd\u5b88\u6027\u306b\u5927\u304d\u306a\u5f71\u97ff\u3092\u4e0e\u3048\u307e\u3059\u3002\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u304b\u3089\u306f\u3001\u5404\u95a2\u6570\u306b\u3064\u3044\u3066\u8a73\u7d30\u306b\u89e3\u8aac\u3057\u3066\u3044\u304d\u307e\u3059\u3002\u307e\u305a\u306f\u6700\u3082\u57fa\u672c\u7684\u3067\u5e83\u304f\u4f7f\u308f\u308c\u3066\u3044\u308b <code>explode()<\/code> \u95a2\u6570\u304b\u3089\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-15\">explode()\u95a2\u6570\u306e\u5fb9\u5e95\u89e3\u8aac<\/h2>\n\n\n\n<p><code>explode()<\/code>\u95a2\u6570\u306fPHP\u3067\u6700\u3082\u57fa\u672c\u7684\u304b\u3064\u983b\u7e41\u306b\u4f7f\u7528\u3055\u308c\u308b\u6587\u5b57\u5217\u5206\u5272\u95a2\u6570\u3067\u3059\u3002\u30b7\u30f3\u30d7\u30eb\u306a\u69cb\u6587\u3068\u9ad8\u3044\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u517c\u306d\u5099\u3048\u3066\u304a\u308a\u3001\u591a\u304f\u306e\u958b\u767a\u8005\u304c\u65e5\u5e38\u7684\u306b\u6d3b\u7528\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001<code>explode()<\/code>\u95a2\u6570\u306e\u4f7f\u3044\u65b9\u304b\u3089\u5fdc\u7528\u30c6\u30af\u30cb\u30c3\u30af\u307e\u3067\u3001\u5b9f\u8df5\u7684\u306a\u4f8b\u3092\u4ea4\u3048\u306a\u304c\u3089\u8a73\u3057\u304f\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-16\">\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\u3068\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u8aac\u660e<\/h3>\n\n\n\n<p><code>explode()<\/code>\u95a2\u6570\u306e\u57fa\u672c\u69cb\u6587\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">array explode(string $separator, string $string, int $limit = PHP_INT_MAX)\n<\/pre>\n\n\n\n<p>\u5404\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5f79\u5272\u306f\u6b21\u306e\u901a\u308a\u3067\u3059\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>$separator<\/strong>\uff08\u5fc5\u9808\uff09: \u533a\u5207\u308a\u6587\u5b57\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u3053\u308c\u306f\u5358\u4e00\u306e\u6587\u5b57\u3067\u3082\u8907\u6570\u306e\u6587\u5b57\u3067\u3082\u69cb\u3044\u307e\u305b\u3093\u3002\u305f\u3060\u3057\u3001\u7a7a\u6587\u5b57\u5217\uff08<code>\"\"<\/code>\uff09\u3092\u6307\u5b9a\u3059\u308b\u3068\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>$string<\/strong>\uff08\u5fc5\u9808\uff09: \u5206\u5272\u5bfe\u8c61\u306e\u6587\u5b57\u5217\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>$limit<\/strong>\uff08\u30aa\u30d7\u30b7\u30e7\u30f3\uff09: \u8fd4\u3055\u308c\u308b\u914d\u5217\u306e\u6700\u5927\u8981\u7d20\u6570\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u5168\u3066\u306e\u8981\u7d20\u304c\u8fd4\u3055\u308c\u307e\u3059\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u623b\u308a\u5024\u306f\u3001\u533a\u5207\u308a\u6587\u5b57\u3067\u5206\u5272\u3055\u308c\u305f\u6587\u5b57\u5217\u306e\u914d\u5217\u3067\u3059\u3002\u3082\u3057\u533a\u5207\u308a\u6587\u5b57\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u3001\u5143\u306e\u6587\u5b57\u5217\u3092\u305d\u306e\u307e\u307e\u542b\u30801\u8981\u7d20\u306e\u914d\u5217\u304c\u8fd4\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u57fa\u672c\u7684\u306a\u4f7f\u7528\u4f8b\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u57fa\u672c\u7684\u306a\u4f7f\u7528\u4f8b\n$string = \"apple,orange,banana,grape\";\n$fruits = explode(\",\", $string);\nprint_r($fruits);\n\/*\n\u7d50\u679c:\nArray\n(\n    [0] =&gt; apple\n    [1] =&gt; orange\n    [2] =&gt; banana\n    [3] =&gt; grape\n)\n*\/\n<\/pre>\n\n\n\n<p><code>explode()<\/code>\u95a2\u6570\u306f\u30b7\u30f3\u30d7\u30eb\u3067\u3042\u308a\u306a\u304c\u3089\u975e\u5e38\u306b\u5f37\u529b\u3067\u3059\u3002\u533a\u5207\u308a\u6587\u5b57\u304c1\u3064\u306e\u5834\u5408\u306f\u3082\u3061\u308d\u3093\u3001\u8907\u6570\u306e\u6587\u5b57\u304b\u3089\u306a\u308b\u533a\u5207\u308a\u6587\u5b57\u3082\u6307\u5b9a\u3067\u304d\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u8907\u6570\u6587\u5b57\u306e\u533a\u5207\u308a\u6587\u5b57\u3092\u4f7f\u7528\u3057\u305f\u4f8b\n$string = \"item1::item2::item3\";\n$items = explode(\"::\", $string);\nprint_r($items);\n\/*\n\u7d50\u679c:\nArray\n(\n    [0] =&gt; item1\n    [1] =&gt; item2\n    [2] =&gt; item3\n)\n*\/\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-17\">\u6587\u5b57\u5217\u3092\u914d\u5217\u306b\u5909\u63db\u3059\u308b\u969b\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/h3>\n\n\n\n<p><code>explode()<\/code>\u95a2\u6570\u3092\u52b9\u679c\u7684\u306b\u4f7f\u3046\u305f\u3081\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3092\u3044\u304f\u3064\u304b\u7d39\u4ecb\u3057\u307e\u3059\uff1a<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-18\">1. \u533a\u5207\u308a\u6587\u5b57\u306e\u5b58\u5728\u30c1\u30a7\u30c3\u30af<\/h4>\n\n\n\n<p>\u533a\u5207\u308a\u6587\u5b57\u304c\u6587\u5b57\u5217\u5185\u306b\u5b58\u5728\u3057\u306a\u3044\u5834\u5408\u3001\u5143\u306e\u6587\u5b57\u5217\u3092\u542b\u30801\u8981\u7d20\u306e\u914d\u5217\u304c\u8fd4\u3055\u308c\u307e\u3059\u3002\u3053\u306e\u6319\u52d5\u3092\u7406\u89e3\u3057\u3066\u9069\u5207\u306b\u51e6\u7406\u3057\u307e\u3057\u3087\u3046\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u533a\u5207\u308a\u6587\u5b57\u304c\u5b58\u5728\u3057\u306a\u3044\u5834\u5408\n$string = \"no-separator-here\";\n$parts = explode(\",\", $string);\necho \"\u5206\u5272\u3055\u308c\u305f\u8981\u7d20\u6570: \" . count($parts); \/\/ \u7d50\u679c: \u5206\u5272\u3055\u308c\u305f\u8981\u7d20\u6570: 1\nprint_r($parts);\n\/*\n\u7d50\u679c:\nArray\n(\n    [0] =&gt; no-separator-here\n)\n*\/\n\n\/\/ \u533a\u5207\u308a\u6587\u5b57\u306e\u5b58\u5728\u3092\u4e8b\u524d\u306b\u30c1\u30a7\u30c3\u30af\u3059\u308b\u4f8b\nif (strpos($string, \",\") !== false) {\n    $parts = explode(\",\", $string);\n    echo \"\u533a\u5207\u308a\u6587\u5b57\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\";\n} else {\n    echo \"\u533a\u5207\u308a\u6587\u5b57\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\";\n    \/\/ \u4ee3\u66ff\u51e6\u7406...\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-19\">2. \u7a7a\u306e\u6587\u5b57\u5217\u306e\u51e6\u7406<\/h4>\n\n\n\n<p>\u7a7a\u306e\u6587\u5b57\u5217\u3092\u5206\u5272\u3059\u308b\u3068\u3001\u7a7a\u306e\u8981\u7d20\u30921\u3064\u6301\u3064\u914d\u5217\u304c\u8fd4\u3055\u308c\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u7a7a\u6587\u5b57\u5217\u306e\u5206\u5272\n$emptyString = \"\";\n$result = explode(\",\", $emptyString);\nprint_r($result);\n\/*\n\u7d50\u679c:\nArray\n(\n    [0] =&gt; \n)\n*\/\n\n\/\/ \u7a7a\u6587\u5b57\u5217\u304b\u3069\u3046\u304b\u3092\u4e8b\u524d\u306b\u30c1\u30a7\u30c3\u30af\u3059\u308b\u4f8b\nif (!empty($string)) {\n    $parts = explode(\",\", $string);\n    \/\/ \u51e6\u7406...\n} else {\n    echo \"\u6587\u5b57\u5217\u304c\u7a7a\u3067\u3059\";\n    \/\/ \u4ee3\u66ff\u51e6\u7406...\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-20\">3. trim()\u3068\u306e\u4f75\u7528<\/h4>\n\n\n\n<p>\u533a\u5207\u3089\u308c\u305f\u90e8\u5206\u306e\u524d\u5f8c\u306b\u4f59\u5206\u306a\u7a7a\u767d\u304c\u3042\u308b\u5834\u5408\u3001<code>array_map()<\/code>\u3068<code>trim()<\/code>\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u9664\u53bb\u3067\u304d\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u5206\u5272\u5f8c\u306b\u5404\u8981\u7d20\u3092trim\u3059\u308b\n$string = \"apple, orange, banana, grape\";\n$fruits = explode(\",\", $string);\n$fruits = array_map('trim', $fruits);\nprint_r($fruits);\n\/*\n\u7d50\u679c:\nArray\n(\n    [0] =&gt; apple\n    [1] =&gt; orange\n    [2] =&gt; banana\n    [3] =&gt; grape\n)\n*\/\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-21\">limit\u5f15\u6570\u3092\u6d3b\u7528\u3057\u305f\u5206\u5272\u5236\u5fa1\u30c6\u30af\u30cb\u30c3\u30af<\/h3>\n\n\n\n<p><code>limit<\/code>\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u4f7f\u3046\u3068\u3001\u8fd4\u3055\u308c\u308b\u914d\u5217\u306e\u8981\u7d20\u6570\u3092\u5236\u5fa1\u3067\u304d\u307e\u3059\u3002\u3053\u306e\u5f15\u6570\u306f\u7279\u306b\u5927\u304d\u306a\u6587\u5b57\u5217\u306e\u4e00\u90e8\u3060\u3051\u3092\u53d6\u5f97\u3057\u305f\u3044\u5834\u5408\u306b\u5f79\u7acb\u3061\u307e\u3059\u3002<\/p>\n\n\n\n<p><code>limit<\/code>\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5024\u306b\u3088\u3063\u3066\u52d5\u4f5c\u304c\u5909\u308f\u308a\u307e\u3059\uff1a<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-22\">1. limit &gt; 0 \u306e\u5834\u5408<\/h4>\n\n\n\n<p>\u914d\u5217\u306f\u6700\u5927\u3067<code>limit<\/code>\u500b\u306e\u8981\u7d20\u3092\u6301\u3061\u307e\u3059\u3002\u3082\u3057\u533a\u5207\u308a\u6587\u5b57\u304c<code>limit-1<\/code>\u56de\u4ee5\u4e0a\u51fa\u73fe\u3059\u308b\u5834\u5408\u3001\u6700\u5f8c\u306e\u8981\u7d20\u306b\u306f\u6b8b\u308a\u306e\u6587\u5b57\u5217\u5168\u4f53\u304c\u542b\u307e\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ limit &gt; 0 \u306e\u4f8b\n$string = \"a:b:c:d:e:f\";\n$parts1 = explode(\":\", $string, 3);\nprint_r($parts1);\n\/*\n\u7d50\u679c:\nArray\n(\n    [0] =&gt; a\n    [1] =&gt; b\n    [2] =&gt; c:d:e:f  \/\/ \u6b8b\u308a\u306e\u90e8\u5206\u306f\u5168\u3066\u6700\u5f8c\u306e\u8981\u7d20\u306b\u542b\u307e\u308c\u308b\n)\n*\/\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-23\">2. limit &lt; 0 \u306e\u5834\u5408<\/h4>\n\n\n\n<p>\u5168\u3066\u306e\u533a\u5207\u308a\u6587\u5b57\u3067\u5206\u5272\u3055\u308c\u307e\u3059\u304c\u3001\u6700\u5f8c\u306e<code>abs(limit)<\/code>\u500b\u306e\u8981\u7d20\u306f\u8fd4\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ limit &lt; 0 \u306e\u4f8b\n$string = \"a:b:c:d:e:f\";\n$parts2 = explode(\":\", $string, -2);\nprint_r($parts2);\n\/*\n\u7d50\u679c:\nArray\n(\n    [0] =&gt; a\n    [1] =&gt; b\n    [2] =&gt; c\n    [3] =&gt; d  \/\/ \u6700\u5f8c\u306e2\u3064\u306e\u8981\u7d20 'e'\u3068'f' \u306f\u9664\u5916\u3055\u308c\u308b\n)\n*\/\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-24\">3. limit = 0 \u306e\u5834\u5408\uff08PHP 5.1.0\u4ee5\u964d\uff09<\/h4>\n\n\n\n<p>\u533a\u5207\u308a\u6587\u5b57\u306f\u7121\u8996\u3055\u308c\u3001\u5165\u529b\u6587\u5b57\u5217\u5168\u4f53\u3092\u542b\u30801\u8981\u7d20\u306e\u914d\u5217\u304c\u8fd4\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ limit = 0 \u306e\u4f8b\n$string = \"a:b:c:d:e:f\";\n$parts3 = explode(\":\", $string, 0);\nprint_r($parts3);\n\/*\n\u7d50\u679c:\nArray\n(\n    [0] =&gt; a:b:c:d:e:f  \/\/ \u5206\u5272\u3055\u308c\u306a\u3044\n)\n*\/\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-25\">\u5b9f\u7528\u7684\u306alimit\u6d3b\u7528\u4f8b<\/h4>\n\n\n\n<p>\u4ee5\u4e0b\u306f<code>limit<\/code>\u3092\u6d3b\u7528\u3057\u305f\u5b9f\u7528\u7684\u306a\u4f8b\u3067\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ CSV\u30d5\u30a1\u30a4\u30eb\u306e\u30d8\u30c3\u30c0\u30fc\u3068\u5185\u5bb9\u3092\u5206\u96e2\u3059\u308b\n$csvData = \"id,name,email,phone\\n1,Tanaka,tanaka@example.com,03-1234-5678\";\n$lines = explode(\"\\n\", $csvData, 2);\n$headers = explode(\",\", $lines[0]);\n$data = explode(\",\", $lines[1]);\n\necho \"\u30d8\u30c3\u30c0\u30fc: \";\nprint_r($headers);\necho \"\u30c7\u30fc\u30bf: \";\nprint_r($data);\n\/*\n\u7d50\u679c:\n\u30d8\u30c3\u30c0\u30fc: Array\n(\n    [0] =&gt; id\n    [1] =&gt; name\n    [2] =&gt; email\n    [3] =&gt; phone\n)\n\u30c7\u30fc\u30bf: Array\n(\n    [0] =&gt; 1\n    [1] =&gt; Tanaka\n    [2] =&gt; tanaka@example.com\n    [3] =&gt; 03-1234-5678\n)\n*\/\n\n\/\/ URL\u306e\u30d1\u30b9\u3068\u30af\u30a8\u30ea\u3092\u5206\u96e2\u3059\u308b\n$url = \"https:\/\/example.com\/search?q=php&amp;lang=ja\";\n$urlParts = explode(\"?\", $url, 2);\n$path = $urlParts[0];\n$query = isset($urlParts[1]) ? $urlParts[1] : '';\n\necho \"\u30d1\u30b9: \" . $path . \"\\n\";\necho \"\u30af\u30a8\u30ea: \" . $query . \"\\n\";\n\/*\n\u7d50\u679c:\n\u30d1\u30b9: https:\/\/example.com\/search\n\u30af\u30a8\u30ea: q=php&amp;lang=ja\n*\/\n<\/pre>\n\n\n\n<p><code>explode()<\/code>\u95a2\u6570\u306f\u30b7\u30f3\u30d7\u30eb\u306a\u304c\u3089\u3082\u3001\u9069\u5207\u306b\u4f7f\u3044\u3053\u306a\u3059\u3053\u3068\u3067\u591a\u304f\u306e\u30c6\u30ad\u30b9\u30c8\u51e6\u7406\u30bf\u30b9\u30af\u3092\u52b9\u7387\u7684\u306b\u89e3\u6c7a\u3067\u304d\u307e\u3059\u3002\u7279\u306b\u5358\u4e00\u306e\u533a\u5207\u308a\u6587\u5b57\u3067\u5206\u5272\u3059\u308b\u5834\u5408\u306f\u3001\u6b63\u898f\u8868\u73fe\u3092\u4f7f\u7528\u3059\u308b<code>preg_split()<\/code>\u3088\u308a\u3082\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u512a\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u53ef\u80fd\u306a\u9650\u308a<code>explode()<\/code>\u3092\u512a\u5148\u3057\u3066\u4f7f\u7528\u3059\u308b\u3053\u3068\u3092\u304a\u52e7\u3081\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u56fa\u5b9a\u9577\u3067\u306e\u6587\u5b57\u5217\u5206\u5272\u3092\u5b9f\u73fe\u3059\u308b<code>str_split()<\/code>\u95a2\u6570\u306b\u3064\u3044\u3066\u8a73\u3057\u304f\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-26\">str_split()\u95a2\u6570\u306e\u30de\u30b9\u30bf\u30fc\u30ac\u30a4\u30c9<\/h2>\n\n\n\n<p><code>str_split()<\/code>\u95a2\u6570\u306f\u6587\u5b57\u5217\u3092\u56fa\u5b9a\u9577\u306e\u30c1\u30e3\u30f3\u30af\u306b\u5206\u5272\u3059\u308b\u305f\u3081\u306e\u4fbf\u5229\u306a\u95a2\u6570\u3067\u3001\u6587\u5b57\u5217\u306e\u5404\u90e8\u5206\u3092\u5747\u7b49\u306a\u9577\u3055\u3067\u51e6\u7406\u3057\u305f\u3044\u5834\u5408\u306b\u6700\u9069\u3067\u3059\u3002\u3053\u306e\u95a2\u6570\u306f<code>explode()<\/code>\u3068\u306f\u7570\u306a\u308b\u30a2\u30d7\u30ed\u30fc\u30c1\u3067\u6587\u5b57\u5217\u3092\u5206\u5272\u3059\u308b\u305f\u3081\u3001\u7279\u5b9a\u306e\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u306b\u304a\u3044\u3066\u306f\u975e\u5e38\u306b\u5f37\u529b\u306a\u30c4\u30fc\u30eb\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-27\">\u56fa\u5b9a\u9577\u3067\u306e\u6587\u5b57\u5217\u5206\u5272\u306e\u4ed5\u7d44\u307f\u3068\u30b3\u30fc\u30c9\u30b5\u30f3\u30d7\u30eb<\/h3>\n\n\n\n<p><code>str_split()<\/code>\u95a2\u6570\u306e\u57fa\u672c\u69cb\u6587\u306f\u6b21\u306e\u901a\u308a\u3067\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">array str_split(string $string, int $length = 1)\n<\/pre>\n\n\n\n<p>\u5404\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5f79\u5272\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>$string<\/strong>\uff08\u5fc5\u9808\uff09: \u5206\u5272\u5bfe\u8c61\u306e\u6587\u5b57\u5217\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>$length<\/strong>\uff08\u30aa\u30d7\u30b7\u30e7\u30f3\uff09: \u5404\u914d\u5217\u8981\u7d20\u306e\u9577\u3055\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306f1\u3067\u3059\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u623b\u308a\u5024\u306f\u3001\u6307\u5b9a\u3057\u305f\u9577\u3055\u3067\u5206\u5272\u3055\u308c\u305f\u6587\u5b57\u5217\u306e\u914d\u5217\u3067\u3059\u3002\u3082\u3057<code>$length<\/code>\u304c\u6587\u5b57\u5217\u306e\u9577\u3055\u3088\u308a\u5927\u304d\u3044\u5834\u5408\u3001\u5143\u306e\u6587\u5b57\u5217\u3092\u542b\u30801\u8981\u7d20\u306e\u914d\u5217\u304c\u8fd4\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u57fa\u672c\u7684\u306a\u4f7f\u7528\u4f8b\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u57fa\u672c\u7684\u306a\u4f7f\u7528\u4f8b\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u9577\u30551\u3067\u5206\u5272\uff09\n$string = \"Hello\";\n$chars = str_split($string);\nprint_r($chars);\n\/*\n\u7d50\u679c:\nArray\n(\n    [0] =&gt; H\n    [1] =&gt; e\n    [2] =&gt; l\n    [3] =&gt; l\n    [4] =&gt; o\n)\n*\/\n\n\/\/ \u6307\u5b9a\u3057\u305f\u9577\u3055\uff082\u6587\u5b57\u305a\u3064\uff09\u3067\u5206\u5272\n$string = \"HelloWorld\";\n$chunks = str_split($string, 2);\nprint_r($chunks);\n\/*\n\u7d50\u679c:\nArray\n(\n    [0] =&gt; He\n    [1] =&gt; ll\n    [2] =&gt; oW\n    [3] =&gt; or\n    [4] =&gt; ld\n)\n*\/\n<\/pre>\n\n\n\n<p><code>str_split()<\/code>\u95a2\u6570\u306f\u975e\u5e38\u306b\u5358\u7d14\u3067\u3042\u308a\u306a\u304c\u3089\u3001\u69d8\u3005\u306a\u7528\u9014\u306b\u6d3b\u7528\u3067\u304d\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u56fa\u5b9a\u9577\u306e\u30c7\u30fc\u30bf\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3092\u51e6\u7406\u3059\u308b\u5834\u5408\u3084\u3001\u6587\u5b57\u5217\u3092\u8996\u899a\u7684\u306b\u6574\u5f62\u3059\u308b\u5834\u5408\u306a\u3069\u306b\u4fbf\u5229\u3067\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30af\u30ec\u30b8\u30c3\u30c8\u30ab\u30fc\u30c9\u756a\u53f7\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\n$cardNumber = \"4111111111111111\";\n$groups = str_split($cardNumber, 4);\n$formattedCard = implode(' ', $groups);\necho $formattedCard; \/\/ \u7d50\u679c: \"4111 1111 1111 1111\"\n\n\/\/ 16\u9032\u6570\u306e\u8868\u793a\u3092\u6574\u5f62\n$hexValue = \"e9a0b9f3c4d2\";\n$bytes = str_split($hexValue, 2);\n$formattedHex = implode(':', $bytes);\necho $formattedHex; \/\/ \u7d50\u679c: \"e9:a0:b9:f3:c4:d2\"\n<\/pre>\n\n\n\n<p><code>$length<\/code>\u30d1\u30e9\u30e1\u30fc\u30bf\u306b0\u4ee5\u4e0b\u306e\u5024\u3092\u6307\u5b9a\u3059\u308b\u3068\u3001\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3059\u308b\u306e\u3067\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u4e0d\u6b63\u306a\u9577\u3055\u3092\u6307\u5b9a\u3057\u305f\u5834\u5408\ntry {\n    $result = str_split(\"test\", 0); \/\/ Warning: str_split(): Length parameter must be greater than 0\n} catch (ValueError $e) {\n    echo \"\u30a8\u30e9\u30fc: \" . $e-&gt;getMessage(); \/\/ PHP 8\u4ee5\u964d\u3067\u306fValueError\u304c\u30b9\u30ed\u30fc\u3055\u308c\u308b\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-28\">\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u5217\u3092\u6271\u3046\u969b\u306e\u6ce8\u610f\u70b9\u3068\u5bfe\u7b56<\/h3>\n\n\n\n<p><code>str_split()<\/code>\u95a2\u6570\u306e\u6700\u5927\u306e\u5236\u9650\u306e\u4e00\u3064\u306f\u3001\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u5217\uff08UTF-8\u306e\u65e5\u672c\u8a9e\u3084\u4e2d\u56fd\u8a9e\u306a\u3069\uff09\u3092\u6b63\u3057\u304f\u51e6\u7406\u3067\u304d\u306a\u3044\u3053\u3068\u3067\u3059\u3002\u3053\u306e\u95a2\u6570\u306f\u30d0\u30a4\u30c8\u5358\u4f4d\u3067\u5206\u5272\u3092\u884c\u3046\u305f\u3081\u3001\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u304c\u9014\u4e2d\u3067\u5206\u65ad\u3055\u308c\u308b\u3068\u6587\u5b57\u5316\u3051\u304c\u767a\u751f\u3057\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u5217\u3067\u306e\u554f\u984c\n$japanese = \"\u3053\u3093\u306b\u3061\u306f\u4e16\u754c\";\n$parts = str_split($japanese, 3);\nprint_r($parts);\n\/*\n\u7d50\u679c: \u6587\u5b57\u5316\u3051\u3057\u305f\u914d\u5217\uff08\u5404\u8981\u7d20\u304c\u6b63\u3057\u3044\u6587\u5b57\u3092\u8868\u73fe\u3057\u3066\u3044\u306a\u3044\uff09\nUTF-8\u3067\u306f\u65e5\u672c\u8a9e\u306e1\u6587\u5b57\u304c3\u30d0\u30a4\u30c8\u3067\u8868\u73fe\u3055\u308c\u308b\u3053\u3068\u304c\u591a\u3044\u305f\u3081\u3001\n3\u30d0\u30a4\u30c8\u305a\u3064\u5206\u5272\u3059\u308b\u3068\u898b\u304b\u3051\u4e0a\u306f1\u6587\u5b57\u305a\u3064\u306b\u306a\u308b\u5834\u5408\u3082\u3042\u308a\u307e\u3059\u304c\u3001\n\u3053\u308c\u306f\u5076\u7136\u3067\u3042\u308a\u3001\u4fe1\u983c\u3067\u304d\u308b\u65b9\u6cd5\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\n*\/\n<\/pre>\n\n\n\n<p>\u3053\u306e\u554f\u984c\u306b\u5bfe\u51e6\u3059\u308b\u305f\u3081\u306e\u65b9\u6cd5\u304c\u3044\u304f\u3064\u304b\u3042\u308a\u307e\u3059\uff1a<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-29\">1. PHP 7.4\u4ee5\u964d: mb_str_split()\u306e\u4f7f\u7528<\/h4>\n\n\n\n<p>PHP 7.4\u3067\u5c0e\u5165\u3055\u308c\u305f<code>mb_str_split()<\/code>\u95a2\u6570\u306f\u3001\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u5217\u3092\u6b63\u3057\u304f\u51e6\u7406\u3067\u304d\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ PHP 7.4\u4ee5\u964d\u3067\u5229\u7528\u53ef\u80fd\nif (function_exists('mb_str_split')) {\n    $japanese = \"\u3053\u3093\u306b\u3061\u306f\u4e16\u754c\";\n    $chars = mb_str_split($japanese); \/\/ 1\u6587\u5b57\u305a\u3064\u5206\u5272\n    print_r($chars);\n    \/*\n    \u7d50\u679c:\n    Array\n    (\n        [0] =&gt; \u3053\n        [1] =&gt; \u3093\n        [2] =&gt; \u306b\n        [3] =&gt; \u3061\n        [4] =&gt; \u306f\n        [5] =&gt; \u4e16\n        [6] =&gt; \u754c\n    )\n    *\/\n    \n    \/\/ 2\u6587\u5b57\u305a\u3064\u306b\u5206\u5272\n    $parts = mb_str_split($japanese, 2);\n    print_r($parts);\n    \/*\n    \u7d50\u679c:\n    Array\n    (\n        [0] =&gt; \u3053\u3093\n        [1] =&gt; \u306b\u3061\n        [2] =&gt; \u306f\u4e16\n        [3] =&gt; \u754c\n    )\n    *\/\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-30\">2. PHP 7.4\u672a\u6e80: mbstring\u62e1\u5f35\u3068\u81ea\u4f5c\u95a2\u6570\u306e\u4f75\u7528<\/h4>\n\n\n\n<p>\u53e4\u3044PHP\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u306f\u3001\u72ec\u81ea\u306e\u95a2\u6570\u3092\u4f5c\u6210\u3057\u3066\u5bfe\u5fdc\u3067\u304d\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ PHP 7.4\u672a\u6e80\u3067\u306e\u4ee3\u66ff\u7b56\nfunction mb_str_split_custom($string, $length = 1, $encoding = \"UTF-8\") {\n    if ($length &lt; 1) {\n        return false;\n    }\n    \n    $result = [];\n    $strlen = mb_strlen($string, $encoding);\n    \n    for ($i = 0; $i &lt; $strlen; $i += $length) {\n        $result[] = mb_substr($string, $i, $length, $encoding);\n    }\n    \n    return $result;\n}\n\n$japanese = \"\u3053\u3093\u306b\u3061\u306f\u4e16\u754c\";\n$chars = mb_str_split_custom($japanese);\nprint_r($chars);\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-31\">3. preg_split()\u306e\u6d3b\u7528<\/h4>\n\n\n\n<p>\u6587\u5b57\u5358\u4f4d\u3067\u5206\u5272\u3057\u305f\u3044\u5834\u5408\u306f\u3001<code>preg_split()<\/code>\u3068\u6b63\u898f\u8868\u73fe\u3092\u4f7f\u3046\u65b9\u6cd5\u3082\u3042\u308a\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ preg_split()\u3092\u4f7f\u3063\u305f\u6587\u5b57\u5358\u4f4d\u306e\u5206\u5272\n$japanese = \"\u3053\u3093\u306b\u3061\u306f\u4e16\u754c\";\n$chars = preg_split('\/\/u', $japanese, -1, PREG_SPLIT_NO_EMPTY);\nprint_r($chars);\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-32\">explode()\u3068\u306e\u4f7f\u3044\u5206\u3051\u306b\u304a\u3051\u308b\u6c7a\u5b9a\u7684\u306a\u5dee\u7570<\/h3>\n\n\n\n<p><code>str_split()<\/code>\u3068<code>explode()<\/code>\u306f\u4e21\u65b9\u3068\u3082\u6587\u5b57\u5217\u3092\u5206\u5272\u3057\u307e\u3059\u304c\u3001\u305d\u306e\u65b9\u6cd5\u3068\u7528\u9014\u306f\u5927\u304d\u304f\u7570\u306a\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u306b\u4e3b\u306a\u9055\u3044\u3092\u307e\u3068\u3081\u307e\u3057\u305f\uff1a<\/p>\n\n\n<div id=\"id-ededed62-f525-4a81-a2b1-7591e394ad57\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u7279\u5fb4<\/th><th>str_split()<\/th><th>explode()<\/th><\/tr><\/thead><tbody><tr><td>\u5206\u5272\u57fa\u6e96<\/td><td>\u56fa\u5b9a\u9577\uff08\u6587\u5b57\u6570\uff09<\/td><td>\u533a\u5207\u308a\u6587\u5b57<\/td><\/tr><tr><td>\u7d50\u679c\u306e\u5747\u4e00\u6027<\/td><td>\u6700\u5f8c\u306e\u8981\u7d20\u4ee5\u5916\u306f\u540c\u3058\u9577\u3055<\/td><td>\u533a\u5207\u308a\u6587\u5b57\u306e\u51fa\u73fe\u306b\u3088\u3063\u3066\u7570\u306a\u308b\u9577\u3055<\/td><\/tr><tr><td>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u5bfe\u5fdc<\/td><td>\u975e\u5bfe\u5fdc\uff08\u8981mb_str_split\uff09<\/td><td>\u533a\u5207\u308a\u6587\u5b57\u304c\u6b63\u3057\u3051\u308c\u3070\u5bfe\u5fdc\u53ef\u80fd<\/td><\/tr><tr><td>\u4e3b\u306a\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9<\/td><td>\u56fa\u5b9a\u9577\u30c7\u30fc\u30bf\u306e\u51e6\u7406\u30011\u6587\u5b57\u305a\u3064\u306e\u51e6\u7406<\/td><td>\u533a\u5207\u308a\u6587\u5b57\u3067\u5206\u3051\u3089\u308c\u305f\u30c7\u30fc\u30bf\u306e\u51e6\u7406<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<p>\u305d\u308c\u305e\u308c\u306e\u95a2\u6570\u304c\u6700\u9069\u306a\u4f7f\u7528\u30b7\u30fc\u30f3\u3092\u5177\u4f53\u7684\u306b\u898b\u3066\u307f\u307e\u3057\u3087\u3046\uff1a<\/p>\n\n\n\n<p><strong>str_split()\u304c\u6700\u9069\u306a\u5834\u5408:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u56fa\u5b9a\u9577\u306e\u30c7\u30fc\u30bf\u30ec\u30b3\u30fc\u30c9\u3092\u51e6\u7406\u3059\u308b\n$record = \"John Doe    New York  35\";\n$parts = [\n    'name' =&gt; trim(substr($record, 0, 10)),\n    'city' =&gt; trim(substr($record, 10, 10)),\n    'age'  =&gt; trim(substr($record, 20, 2))\n];\n\/\/ \u307e\u305f\u306f\n$chunks = str_split($record, 10);\n$parts = [\n    'name' =&gt; trim($chunks[0]),\n    'city' =&gt; trim($chunks[1]),\n    'age'  =&gt; trim($chunks[2])\n];\n\n\/\/ \u96fb\u8a71\u756a\u53f7\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\n$phone = \"08012345678\";\n$parts = str_split($phone, 3);\necho implode('-', $parts); \/\/ \u7d50\u679c: \"080-123-456-78\"\n\n\/\/ \u6587\u5b57\u3054\u3068\u306b\u51e6\u7406\uff08\u30b7\u30f3\u30b0\u30eb\u30d0\u30a4\u30c8\u6587\u5b57\u306e\u307f\uff09\n$text = \"Hello\";\nforeach (str_split($text) as $char) {\n    echo ord($char) . \" \"; \/\/ \u5404\u6587\u5b57\u306eASCII\u30b3\u30fc\u30c9\u3092\u8868\u793a\n}\n<\/pre>\n\n\n\n<p><strong>explode()\u304c\u6700\u9069\u306a\u5834\u5408:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ CSV\u30c7\u30fc\u30bf\u306e\u51e6\u7406\n$csvLine = \"John,Doe,35,New York\";\n$data = explode(',', $csvLine);\n\n\/\/ URL\u306e\u89e3\u6790\n$url = \"https:\/\/example.com\/path\/to\/page\";\n$parts = explode('\/', $url);\n\n\/\/ \u6587\u7ae0\u3092\u5358\u8a9e\u306b\u5206\u5272\n$sentence = \"This is a sample sentence\";\n$words = explode(' ', $sentence);\n<\/pre>\n\n\n\n<p><code>str_split()<\/code>\u306f\u56fa\u5b9a\u9577\u306e\u30c7\u30fc\u30bf\u5f62\u5f0f\u3092\u6271\u3046\u5834\u5408\u3084\u3001\u6587\u5b57\u5358\u4f4d\u306e\u51e6\u7406\uff08\u30b7\u30f3\u30b0\u30eb\u30d0\u30a4\u30c8\u6587\u5b57\u306e\u307f\uff09\u306b\u6700\u9069\u3067\u3059\u3002\u4e00\u65b9\u3001<code>explode()<\/code>\u306f\u533a\u5207\u308a\u6587\u5b57\u3067\u5206\u3051\u3089\u308c\u305f\u30c7\u30fc\u30bf\u69cb\u9020\u3092\u51e6\u7406\u3059\u308b\u5834\u5408\u306b\u9069\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u5b9f\u969b\u306e\u958b\u767a\u3067\u306f\u3001\u30c7\u30fc\u30bf\u306e\u7279\u6027\u306b\u5fdc\u3058\u3066\u9069\u5207\u306a\u95a2\u6570\u3092\u9078\u629e\u3059\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u6271\u3046\u5834\u5408\u306f\u7279\u306b\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3001PHP 7.4\u4ee5\u964d\u3067\u306f<code>mb_str_split()<\/code>\u306e\u4f7f\u7528\u3092\u691c\u8a0e\u3059\u3079\u304d\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u6b63\u898f\u8868\u73fe\u3092\u4f7f\u3063\u305f\u9ad8\u5ea6\u306a\u6587\u5b57\u5217\u5206\u5272\u3092\u5b9f\u73fe\u3059\u308b<code>preg_split()<\/code>\u95a2\u6570\u306b\u3064\u3044\u3066\u8a73\u3057\u304f\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-33\">preg_split()\u3067\u5b9f\u73fe\u3059\u308b\u9ad8\u5ea6\u306a\u6587\u5b57\u5217\u5206\u5272<\/h2>\n\n\n\n<p><code>preg_split()<\/code>\u95a2\u6570\u306f\u3001PHP\u3067\u63d0\u4f9b\u3055\u308c\u308b\u6700\u3082\u5f37\u529b\u306a\u6587\u5b57\u5217\u5206\u5272\u95a2\u6570\u306e\u4e00\u3064\u3067\u3059\u3002\u6b63\u898f\u8868\u73fe\u3092\u4f7f\u7528\u3057\u3066\u6587\u5b57\u5217\u3092\u5206\u5272\u3067\u304d\u308b\u305f\u3081\u3001\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u3084\u6761\u4ef6\u306b\u57fa\u3065\u3044\u305f\u67d4\u8edf\u306a\u5206\u5272\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002\u56fa\u5b9a\u306e\u533a\u5207\u308a\u6587\u5b57\u3067\u306f\u5bfe\u5fdc\u3067\u304d\u306a\u3044\u30b1\u30fc\u30b9\u3067\u3082\u3001<code>preg_split()<\/code>\u3092\u4f7f\u3048\u3070\u52b9\u679c\u7684\u306b\u89e3\u6c7a\u3067\u304d\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-34\">\u6b63\u898f\u8868\u73fe\u3092\u6d3b\u7528\u3057\u305f\u67d4\u8edf\u306a\u5206\u5272\u30d1\u30bf\u30fc\u30f3\u8a2d\u8a08<\/h3>\n\n\n\n<p><code>preg_split()<\/code>\u95a2\u6570\u306e\u57fa\u672c\u69cb\u6587\u306f\u6b21\u306e\u901a\u308a\u3067\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">array preg_split(string $pattern, string $subject, int $limit = -1, int $flags = 0)\n<\/pre>\n\n\n\n<p>\u5404\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5f79\u5272\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>$pattern<\/strong>\uff08\u5fc5\u9808\uff09: \u5206\u5272\u306b\u4f7f\u7528\u3059\u308b\u6b63\u898f\u8868\u73fe\u30d1\u30bf\u30fc\u30f3\u3002\u30c7\u30ea\u30df\u30bf\uff08\u901a\u5e38\u306f<code>\/<\/code>\uff09\u3067\u56f2\u3080\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>$subject<\/strong>\uff08\u5fc5\u9808\uff09: \u5206\u5272\u5bfe\u8c61\u306e\u6587\u5b57\u5217\u3002<\/li>\n\n\n\n<li><strong>$limit<\/strong>\uff08\u30aa\u30d7\u30b7\u30e7\u30f3\uff09: \u8fd4\u3055\u308c\u308b\u914d\u5217\u306e\u6700\u5927\u8981\u7d20\u6570\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306f-1\u3067\u3001\u5236\u9650\u306a\u3057\u3092\u610f\u5473\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>$flags<\/strong>\uff08\u30aa\u30d7\u30b7\u30e7\u30f3\uff09: \u8ffd\u52a0\u306e\u52d5\u4f5c\u30d5\u30e9\u30b0\u3002\u8907\u6570\u306e\u30d5\u30e9\u30b0\u3092\u8ad6\u7406\u548c\uff08<code>|<\/code>\uff09\u3067\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u6b63\u898f\u8868\u73fe\u306e\u5f37\u307f\u3092\u6d3b\u304b\u3057\u305f\u69d8\u3005\u306a\u5206\u5272\u30d1\u30bf\u30fc\u30f3\u306e\u4f8b\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\uff1a<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-35\">1. \u8907\u6570\u306e\u533a\u5207\u308a\u6587\u5b57\u3067\u5206\u5272\u3059\u308b<\/h4>\n\n\n\n<p><code>explode()<\/code>\u3067\u306f\u4e00\u3064\u306e\u533a\u5207\u308a\u6587\u5b57\u3057\u304b\u6307\u5b9a\u3067\u304d\u307e\u305b\u3093\u304c\u3001<code>preg_split()<\/code>\u3067\u306f\u8907\u6570\u306e\u533a\u5207\u308a\u6587\u5b57\u3092\u6307\u5b9a\u3067\u304d\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30ab\u30f3\u30de\u3001\u30bb\u30df\u30b3\u30ed\u30f3\u3001\u30bf\u30d6\u306e\u3044\u305a\u308c\u304b\u3067\u5206\u5272\n$string = \"item1,item2;item3\\titem4\";\n$result = preg_split('\/[,;\\t]\/', $string);\nprint_r($result);\n\/*\n\u7d50\u679c:\nArray\n(\n    [0] =&gt; item1\n    [1] =&gt; item2\n    [2] =&gt; item3\n    [3] =&gt; item4\n)\n*\/\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-36\">2. \u7a7a\u767d\u6587\u5b57\uff08\u30b9\u30da\u30fc\u30b9\u3001\u30bf\u30d6\u3001\u6539\u884c\u306a\u3069\uff09\u3067\u5206\u5272\u3059\u308b<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u4efb\u610f\u306e\u7a7a\u767d\u6587\u5b57\uff08\u9023\u7d9a\u3059\u308b\u5834\u5408\u3082\uff09\u3067\u5206\u5272\n$string = \"Hello  World\\tFrom\\nPHP\";\n$words = preg_split('\/\\s+\/', $string);\nprint_r($words);\n\/*\n\u7d50\u679c:\nArray\n(\n    [0] =&gt; Hello\n    [1] =&gt; World\n    [2] =&gt; From\n    [3] =&gt; PHP\n)\n*\/\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-37\">3. \u5358\u8a9e\u5883\u754c\u3067\u5206\u5272\u3059\u308b<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u5358\u8a9e\u306e\u533a\u5207\u308a\u3067\u5206\u5272\uff08\u8a18\u53f7\u3084\u7a7a\u767d\u3092\u542b\u3080\uff09\n$string = \"Hello, world! This is a test.\";\n$parts = preg_split('\/\\b\/', $string);\nprint_r($parts);\n\/*\n\u7d50\u679c\u306b\u306f\u5358\u8a9e\u3068\u533a\u5207\u308a\u6587\u5b57\u304c\u4ea4\u4e92\u306b\u542b\u307e\u308c\u308b\n*\/\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-38\">4. \u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u3067\u5206\u5272\u3059\u308b<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u6570\u5b57\u306e\u524d\u5f8c\u3067\u5206\u5272\n$string = \"text123more456text\";\n$parts = preg_split('\/(?&lt;=\\d)(?=\\D)|(?&lt;=\\D)(?=\\d)\/', $string);\nprint_r($parts);\n\/*\n\u7d50\u679c:\nArray\n(\n    [0] =&gt; text\n    [1] =&gt; 123\n    [2] =&gt; more\n    [3] =&gt; 456\n    [4] =&gt; text\n)\n*\/\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-39\">5. HTML\u30bf\u30b0\u3092\u57fa\u6e96\u306b\u5206\u5272\u3059\u308b<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ HTML\u30bf\u30b0\u3068\u30c6\u30ad\u30b9\u30c8\u3092\u5206\u96e2\n$html = \"&lt;p&gt;\u3053\u308c\u306f&lt;strong&gt;\u91cd\u8981\u306a&lt;\/strong&gt;\u304a\u77e5\u3089\u305b\u3067\u3059\u3002&lt;\/p&gt;\";\n$parts = preg_split('\/(&lt;[^&gt;]*&gt;)\/', $html, -1, PREG_SPLIT_DELIM_CAPTURE);\nprint_r($parts);\n\/*\n\u7d50\u679c:\nArray\n(\n    [0] =&gt; \n    [1] =&gt; &lt;p&gt;\n    [2] =&gt; \u3053\u308c\u306f\n    [3] =&gt; &lt;strong&gt;\n    [4] =&gt; \u91cd\u8981\u306a\n    [5] =&gt; &lt;\/strong&gt;\n    [6] =&gt; \u304a\u77e5\u3089\u305b\u3067\u3059\u3002\n    [7] =&gt; &lt;\/p&gt;\n    [8] =&gt; \n)\n*\/\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-40\">\u30d5\u30e9\u30b0\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u99c6\u4f7f\u3057\u305f\u5206\u5272\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba<\/h3>\n\n\n\n<p><code>preg_split()<\/code>\u306e<code>$flags<\/code>\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u5206\u5272\u51e6\u7406\u3092\u3055\u3089\u306b\u7d30\u304b\u304f\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3067\u304d\u307e\u3059\u3002\u4e3b\u8981\u306a\u30d5\u30e9\u30b0\u3068\u305d\u306e\u52b9\u679c\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\uff1a<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-41\">1. PREG_SPLIT_NO_EMPTY<\/h4>\n\n\n\n<p>\u7a7a\u306e\u8981\u7d20\u3092\u7d50\u679c\u304b\u3089\u9664\u5916\u3057\u307e\u3059\u3002\u533a\u5207\u308a\u6587\u5b57\u304c\u9023\u7d9a\u3059\u308b\u5834\u5408\u306b\u6709\u7528\u3067\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u533a\u5207\u308a\u6587\u5b57\u304c\u9023\u7d9a\u3059\u308b\u30b1\u30fc\u30b9\n$string = \"field1,,field3,,,field6\";\n$result1 = preg_split('\/,\/', $string);\n$result2 = preg_split('\/,\/', $string, -1, PREG_SPLIT_NO_EMPTY);\n\necho \"\u901a\u5e38\u306e\u5206\u5272\uff1a\\n\";\nprint_r($result1);\necho \"\u7a7a\u8981\u7d20\u3092\u9664\u5916\uff1a\\n\";\nprint_r($result2);\n\/*\n\u7d50\u679c:\n\u901a\u5e38\u306e\u5206\u5272\uff1a\nArray\n(\n    [0] =&gt; field1\n    [1] =&gt; \n    [2] =&gt; field3\n    [3] =&gt; \n    [4] =&gt; \n    [5] =&gt; field6\n)\n\u7a7a\u8981\u7d20\u3092\u9664\u5916\uff1a\nArray\n(\n    [0] =&gt; field1\n    [1] =&gt; field3\n    [2] =&gt; field6\n)\n*\/\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-42\">2. PREG_SPLIT_DELIM_CAPTURE<\/h4>\n\n\n\n<p>\u6b63\u898f\u8868\u73fe\u30d1\u30bf\u30fc\u30f3\u5185\u306e\u62ec\u5f27\u3067\u56f2\u307e\u308c\u305f\u90e8\u5206\uff08\u30ad\u30e3\u30d7\u30c1\u30e3\u30b0\u30eb\u30fc\u30d7\uff09\u3082\u7d50\u679c\u306b\u542b\u3081\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ HTML\u30bf\u30b0\u3092\u62bd\u51fa\u3057\u306a\u304c\u3089\u5206\u5272\n$html = \"&lt;p&gt;\u30c6\u30b9\u30c8&lt;\/p&gt;&lt;div&gt;\u5185\u5bb9&lt;\/div&gt;\";\n$parts = preg_split('\/(&lt;\\\/?[a-z]+&gt;)\/', $html, -1, PREG_SPLIT_DELIM_CAPTURE);\nprint_r($parts);\n\/*\n\u7d50\u679c:\nArray\n(\n    [0] =&gt; \n    [1] =&gt; &lt;p&gt;\n    [2] =&gt; \u30c6\u30b9\u30c8\n    [3] =&gt; &lt;\/p&gt;\n    [4] =&gt; \n    [5] =&gt; &lt;div&gt;\n    [6] =&gt; \u5185\u5bb9\n    [7] =&gt; &lt;\/div&gt;\n    [8] =&gt; \n)\n*\/\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-43\">3. PREG_SPLIT_OFFSET_CAPTURE<\/h4>\n\n\n\n<p>\u5404\u8981\u7d20\u306e\u6587\u5b57\u5217\u30aa\u30d5\u30bb\u30c3\u30c8\uff08\u4f4d\u7f6e\uff09\u3082\u542b\u3081\u3066\u8fd4\u3057\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u5358\u8a9e\u306e\u4f4d\u7f6e\u3082\u53d6\u5f97\n$text = \"Hello World PHP\";\n$words = preg_split('\/\\s+\/', $text, -1, PREG_SPLIT_OFFSET_CAPTURE);\nprint_r($words);\n\/*\n\u7d50\u679c:\nArray\n(\n    [0] =&gt; Array\n        (\n            [0] =&gt; Hello\n            [1] =&gt; 0\n        )\n    [1] =&gt; Array\n        (\n            [0] =&gt; World\n            [1] =&gt; 6\n        )\n    [2] =&gt; Array\n        (\n            [0] =&gt; PHP\n            [1] =&gt; 12\n        )\n)\n*\/\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-44\">4. \u30d5\u30e9\u30b0\u306e\u7d44\u307f\u5408\u308f\u305b<\/h4>\n\n\n\n<p>\u8907\u6570\u306e\u30d5\u30e9\u30b0\u3092\u8ad6\u7406\u548c\u3067\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u8907\u6570\u306e\u30d5\u30e9\u30b0\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\n$html = \"&lt;p&gt;\u30c6\u30b9\u30c8&lt;\/p&gt;&lt;div&gt;&lt;\/div&gt;\";\n$parts = preg_split('\/(&lt;\\\/?[a-z]+&gt;)\/', $html, -1, \n          PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);\nprint_r($parts);\n\/*\n\u7d50\u679c:\nArray\n(\n    [0] =&gt; &lt;p&gt;\n    [1] =&gt; \u30c6\u30b9\u30c8\n    [2] =&gt; &lt;\/p&gt;\n    [3] =&gt; &lt;div&gt;\n    [4] =&gt; &lt;\/div&gt;\n)\n*\/\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-45\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u8003\u616e\u3057\u305f\u6b63\u898f\u8868\u73fe\u30d1\u30bf\u30fc\u30f3\u306e\u6700\u9069\u5316<\/h3>\n\n\n\n<p><code>preg_split()<\/code>\u306f\u5f37\u529b\u3067\u3059\u304c\u3001<code>explode()<\/code>\u3084<code>str_split()<\/code>\u3068\u6bd4\u8f03\u3059\u308b\u3068\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u52a3\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u30dd\u30a4\u30f3\u30c8\u3092\u8003\u616e\u3057\u3066\u3001\u6b63\u898f\u8868\u73fe\u30d1\u30bf\u30fc\u30f3\u3092\u6700\u9069\u5316\u3057\u307e\u3057\u3087\u3046\uff1a<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-46\">1. \u5358\u7d14\u306a\u30b1\u30fc\u30b9\u3067\u306f\u4ee3\u66ff\u95a2\u6570\u3092\u691c\u8a0e\u3059\u308b<\/h4>\n\n\n\n<p>\u533a\u5207\u308a\u6587\u5b57\u304c\u5358\u7d14\u306a\u5834\u5408\u306f\u3001<code>explode()<\/code>\u306e\u65b9\u304c\u9ad8\u901f\u3067\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u5358\u7d14\u306a\u30b1\u30fc\u30b9\u3067\u306fexplode()\u304c\u9ad8\u901f\n$string = \"item1,item2,item3\";\n\n\/\/ \u63a8\u5968\uff08\u9ad8\u901f\uff09\n$parts1 = explode(',', $string);\n\n\/\/ \u975e\u63a8\u5968\uff08\u4f4e\u901f\uff09\n$parts2 = preg_split('\/,\/', $string);\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-47\">2. \u8d2a\u6b32\u306a\u91cf\u6307\u5b9a\u5b50\u306e\u4f7f\u7528\u3092\u6700\u5c0f\u9650\u306b<\/h4>\n\n\n\n<p><code>*<\/code>\u3084<code>+<\/code>\u306a\u3069\u306e\u8d2a\u6b32\u306a\u91cf\u6307\u5b9a\u5b50\u306e\u4f7f\u7528\u306f\u6700\u5c0f\u9650\u306b\u3057\u3001\u53ef\u80fd\u3067\u3042\u308c\u3070\u7bc4\u56f2\u3092\u9650\u5b9a\u3057\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u975e\u52b9\u7387\u7684\u306a\u30d1\u30bf\u30fc\u30f3\n$inefficient = preg_split('\/.*,\/', $string);\n\n\/\/ \u52b9\u7387\u7684\u306a\u30d1\u30bf\u30fc\u30f3\n$efficient = preg_split('\/[^,]*,\/', $string);\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-48\">3. \u904e\u5270\u306a\u30ad\u30e3\u30d7\u30c1\u30e3\u30b0\u30eb\u30fc\u30d7\u3092\u907f\u3051\u308b<\/h4>\n\n\n\n<p>\u5fc5\u8981\u306a\u3044\u5834\u5408\u306f\u3001\u30ad\u30e3\u30d7\u30c1\u30e3\u30b0\u30eb\u30fc\u30d7\uff08\u62ec\u5f27\uff09\u306e\u4ee3\u308f\u308a\u306b\u975e\u30ad\u30e3\u30d7\u30c1\u30e3\u30b0\u30eb\u30fc\u30d7\uff08<code>(?:...)<\/code>\uff09\u3092\u4f7f\u7528\u3057\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30ad\u30e3\u30d7\u30c1\u30e3\u30b0\u30eb\u30fc\u30d7\u3092\u4f7f\u7528\uff08\u975e\u5fc5\u8981\u6642\uff09\n$parts1 = preg_split('\/(and|or|but)\/', $text);\n\n\/\/ \u975e\u30ad\u30e3\u30d7\u30c1\u30e3\u30b0\u30eb\u30fc\u30d7\u3092\u4f7f\u7528\uff08\u63a8\u5968\uff09\n$parts2 = preg_split('\/(?:and|or|but)\/', $text);\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-49\">4. Unicode\u51e6\u7406\u3092\u6700\u9069\u5316\u3059\u308b<\/h4>\n\n\n\n<p>Unicode\u6587\u5b57\u3092\u51e6\u7406\u3059\u308b\u5834\u5408\u306f\u3001<code>u<\/code>\u4fee\u98fe\u5b50\uff08PCRE UTF-8\u30e2\u30fc\u30c9\uff09\u3092\u4f7f\u7528\u3057\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u6b63\u3057\u304f\u51e6\u7406\n$text = \"\u3053\u3093\u306b\u3061\u306f\u4e16\u754c\";\n$chars = preg_split('\/\/u', $text, -1, PREG_SPLIT_NO_EMPTY);\nprint_r($chars);\n\/*\n\u7d50\u679c:\nArray\n(\n    [0] =&gt; \u3053\n    [1] =&gt; \u3093\n    [2] =&gt; \u306b\n    [3] =&gt; \u3061\n    [4] =&gt; \u306f\n    [5] =&gt; \u4e16\n    [6] =&gt; \u754c\n)\n*\/\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-50\">5. \u5b9f\u7528\u7684\u306a\u30d9\u30f3\u30c1\u30de\u30fc\u30af\u4f8b<\/h4>\n\n\n\n<p>\u4ee5\u4e0b\u306f\u3001\u7570\u306a\u308b\u65b9\u6cd5\u3067\u306e\u6587\u5b57\u5217\u5206\u5272\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6bd4\u8f03\u3067\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$string = str_repeat(\"word1,word2;word3\\nword4 word5\", 1000);\n\n$start = microtime(true);\n$result1 = explode(',', $string);\n$time1 = microtime(true) - $start;\n\n$start = microtime(true);\n$result2 = preg_split('\/,\/', $string);\n$time2 = microtime(true) - $start;\n\n$start = microtime(true);\n$result3 = preg_split('\/[,;\\s]+\/', $string);\n$time3 = microtime(true) - $start;\n\necho \"explode(): \" . $time1 . \"\u79d2\\n\";\necho \"preg_split() (\u5358\u7d14): \" . $time2 . \"\u79d2\\n\";\necho \"preg_split() (\u8907\u96d1): \" . $time3 . \"\u79d2\\n\";\n<\/pre>\n\n\n\n<p><code>preg_split()<\/code>\u306f\u67d4\u8edf\u6027\u304c\u9ad8\u3044\u53cd\u9762\u3001\u5358\u7d14\u306a\u30b1\u30fc\u30b9\u3067\u306f\u4ed6\u306e\u5206\u5272\u95a2\u6570\u3088\u308a\u3082\u51e6\u7406\u304c\u9045\u304f\u306a\u308a\u307e\u3059\u3002\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u30f3\u30b0\u304c\u5fc5\u8981\u306a\u5834\u5408\u306e\u307f\u4f7f\u7528\u3059\u308b\u306e\u304c\u9069\u5207\u3067\u3059\u3002<\/p>\n\n\n\n<p><code>preg_split()<\/code>\u306e\u771f\u306e\u4fa1\u5024\u306f\u3001\u4ed6\u306e\u65b9\u6cd5\u3067\u306f\u5b9f\u73fe\u56f0\u96e3\u306a\u8907\u96d1\u306a\u5206\u5272\u30d1\u30bf\u30fc\u30f3\u3092\u5b9f\u73fe\u3067\u304d\u308b\u70b9\u306b\u3042\u308a\u307e\u3059\u3002\u8907\u6570\u306e\u533a\u5207\u308a\u6587\u5b57\u3001\u30d1\u30bf\u30fc\u30f3\u30d9\u30fc\u30b9\u306e\u5206\u5272\u3001\u304a\u3088\u3073\u7279\u5b9a\u306e\u6761\u4ef6\u306b\u57fa\u3065\u304f\u5206\u5272\u306a\u3069\u3001\u9ad8\u5ea6\u306a\u51e6\u7406\u304c\u5fc5\u8981\u306a\u5834\u5408\u306b\u5a01\u529b\u3092\u767a\u63ee\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001PHP 8.0\u4ee5\u964d\u306b\u5c0e\u5165\u3055\u308c\u305f\u6587\u5b57\u5217\u95a2\u9023\u306e\u65b0\u6a5f\u80fd\u3068\u3001\u6587\u5b57\u5217\u5206\u5272\u306b\u304a\u3051\u308b\u9032\u5316\u306b\u3064\u3044\u3066\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-51\">PHP 8.0\u4ee5\u964d\u306e\u65b0\u6a5f\u80fd\u3068\u6587\u5b57\u5217\u5206\u5272<\/h2>\n\n\n\n<p>PHP 8.0\u4ee5\u964d\u3067\u306f\u3001\u6587\u5b57\u5217\u64cd\u4f5c\u3092\u3088\u308a\u52b9\u7387\u7684\u304b\u3064\u76f4\u611f\u7684\u306b\u884c\u3048\u308b\u3088\u3046\u306b\u306a\u308b\u91cd\u8981\u306a\u6a5f\u80fd\u304c\u591a\u6570\u5c0e\u5165\u3055\u308c\u307e\u3057\u305f\u3002\u6587\u5b57\u5217\u5206\u5272\u306b\u76f4\u63a5\u95a2\u308f\u308b\u65b0\u6a5f\u80fd\u3060\u3051\u3067\u306a\u304f\u3001\u6587\u5b57\u5217\u51e6\u7406\u5168\u822c\u3092\u6539\u5584\u3059\u308b\u6a5f\u80fd\u3082\u8ffd\u52a0\u3055\u308c\u3001\u958b\u767a\u52b9\u7387\u3068\u30b3\u30fc\u30c9\u306e\u53ef\u8aad\u6027\u304c\u5927\u5e45\u306b\u5411\u4e0a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-52\">PHP 8.0\u3067\u5c0e\u5165\u3055\u308c\u305f\u6587\u5b57\u5217\u95a2\u9023\u306e\u65b0\u6a5f\u80fd<\/h3>\n\n\n\n<p>PHP 8.0\uff082020\u5e7411\u6708\u30ea\u30ea\u30fc\u30b9\uff09\u3067\u306f\u3001\u9577\u5e74\u958b\u767a\u8005\u304b\u3089\u8981\u671b\u306e\u3042\u3063\u305f\u4fbf\u5229\u306a\u6587\u5b57\u5217\u64cd\u4f5c\u95a2\u6570\u304c\u6a19\u6e96\u5316\u3055\u308c\u307e\u3057\u305f\u3002\u3053\u308c\u3089\u306e\u95a2\u6570\u306f\u4ee5\u524d\u304b\u3089\u30dd\u30ea\u30d5\u30a3\u30eb\u3068\u3057\u3066\u5b58\u5728\u3057\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u8a00\u8a9e\u30b3\u30a2\u306b\u7d44\u307f\u8fbc\u307e\u308c\u305f\u3053\u3068\u3067\u3088\u308a\u6700\u9069\u5316\u3055\u308c\u3001\u5b89\u5168\u306b\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-53\">1. \u6587\u5b57\u5217\u691c\u7d22\u95a2\u9023\u306e\u65b0\u95a2\u6570<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ str_contains() - \u6587\u5b57\u5217\u304c\u90e8\u5206\u6587\u5b57\u5217\u3092\u542b\u3080\u304b\u3092\u30c1\u30a7\u30c3\u30af\n$haystack = \"Hello, World!\";\n$needle = \"World\";\n\n\/\/ PHP 8.0\u4ee5\u964d\nif (str_contains($haystack, $needle)) {\n    echo \"\u6587\u5b57\u5217\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\uff01\\n\";\n}\n\n\/\/ PHP 7.4\u4ee5\u524d\u306e\u65b9\u6cd5\nif (strpos($haystack, $needle) !== false) {\n    echo \"\u6587\u5b57\u5217\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\uff01\\n\";\n}\n<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ str_starts_with() - \u6587\u5b57\u5217\u304c\u7279\u5b9a\u306e\u90e8\u5206\u6587\u5b57\u5217\u3067\u59cb\u307e\u308b\u304b\u3092\u30c1\u30a7\u30c3\u30af\n$string = \"Hello, World!\";\n\n\/\/ PHP 8.0\u4ee5\u964d\nif (str_starts_with($string, \"Hello\")) {\n    echo \"\u300cHello\u300d\u3067\u59cb\u307e\u3063\u3066\u3044\u307e\u3059\\n\";\n}\n\n\/\/ PHP 7.4\u4ee5\u524d\u306e\u65b9\u6cd5\nif (strpos($string, \"Hello\") === 0) {\n    echo \"\u300cHello\u300d\u3067\u59cb\u307e\u3063\u3066\u3044\u307e\u3059\\n\";\n}\n<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ str_ends_with() - \u6587\u5b57\u5217\u304c\u7279\u5b9a\u306e\u90e8\u5206\u6587\u5b57\u5217\u3067\u7d42\u308f\u308b\u304b\u3092\u30c1\u30a7\u30c3\u30af\n$string = \"Hello, World!\";\n\n\/\/ PHP 8.0\u4ee5\u964d\nif (str_ends_with($string, \"World!\")) {\n    echo \"\u300cWorld!\u300d\u3067\u7d42\u308f\u3063\u3066\u3044\u307e\u3059\\n\";\n}\n\n\/\/ PHP 7.4\u4ee5\u524d\u306e\u65b9\u6cd5\nif (substr($string, -6) === \"World!\") {\n    echo \"\u300cWorld!\u300d\u3067\u7d42\u308f\u3063\u3066\u3044\u307e\u3059\\n\";\n}\n<\/pre>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u95a2\u6570\u306f\u6587\u5b57\u5217\u5206\u5272\u306b\u304a\u3044\u3066\u3001\u5206\u5272\u3059\u3079\u304d\u304b\u3069\u3046\u304b\u306e\u5224\u65ad\u3084\u3001\u5206\u5272\u524d\u306e\u691c\u8a3c\u306b\u975e\u5e38\u306b\u5f79\u7acb\u3061\u307e\u3059\u3002\u7279\u306b\u5927\u91cf\u306e\u30c6\u30ad\u30b9\u30c8\u51e6\u7406\u3092\u884c\u3046\u5834\u5408\u3001\u30b3\u30fc\u30c9\u304c\u3088\u308a\u76f4\u611f\u7684\u306b\u306a\u308a\u3001\u30d0\u30b0\u306e\u53ef\u80fd\u6027\u3082\u6e1b\u5c11\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-54\">2. \u3088\u308a\u6d17\u7df4\u3055\u308c\u305f\u6761\u4ef6\u5206\u5c90\uff1amatch\u5f0f<\/h4>\n\n\n\n<p>PHP 8.0\u3067\u306f\u3001switch\u6587\u306e\u5f37\u5316\u7248\u3068\u3057\u3066<code>match<\/code>\u5f0f\u304c\u5c0e\u5165\u3055\u308c\u307e\u3057\u305f\u3002\u6587\u5b57\u5217\u306e\u5206\u5c90\u51e6\u7406\u304c\u3088\u308a\u7c21\u6f54\u306b\u66f8\u3051\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u6587\u5b57\u5217\u306e\u7a2e\u985e\u306b\u3088\u308b\u5206\u5c90\u51e6\u7406\n$text = \"Hello, World!\";\n\n\/\/ PHP 8.0\u4ee5\u964d - match\u5f0f\n$result = match (true) {\n    str_contains($text, 'Hello') =&gt; '\u6328\u62f6\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059',\n    str_contains($text, 'Goodbye') =&gt; '\u5225\u308c\u306e\u8a00\u8449\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059',\n    default =&gt; '\u7279\u5b9a\u306e\u30ad\u30fc\u30ef\u30fc\u30c9\u306f\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f'\n};\n\n\/\/ PHP 7.4\u4ee5\u524d - switch\u6587\nswitch (true) {\n    case strpos($text, 'Hello') !== false:\n        $result = '\u6328\u62f6\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059';\n        break;\n    case strpos($text, 'Goodbye') !== false:\n        $result = '\u5225\u308c\u306e\u8a00\u8449\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059';\n        break;\n    default:\n        $result = '\u7279\u5b9a\u306e\u30ad\u30fc\u30ef\u30fc\u30c9\u306f\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f';\n}\n<\/pre>\n\n\n\n<p><code>match<\/code>\u5f0f\u306f\u53b3\u5bc6\u306a\u6bd4\u8f03\uff08<code>===<\/code>\uff09\u3092\u4f7f\u7528\u3059\u308b\u305f\u3081\u3001\u578b\u306e\u554f\u984c\u3092\u65e9\u671f\u306b\u767a\u898b\u3067\u304d\u3001\u4e88\u671f\u3057\u306a\u3044\u52d5\u4f5c\u3092\u9632\u6b62\u3067\u304d\u307e\u3059\u3002\u307e\u305f\u3001\u30d5\u30a9\u30fc\u30eb\u30b9\u30eb\u30fc\uff08break\u306e\u5fd8\u308c\uff09\u306e\u3088\u3046\u306a\u30d0\u30b0\u3082\u9632\u6b62\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-55\">3. \u540d\u524d\u4ed8\u304d\u5f15\u6570<\/h4>\n\n\n\n<p>\u6587\u5b57\u5217\u5206\u5272\u95a2\u6570\u3092\u542b\u3080\u95a2\u6570\u547c\u3073\u51fa\u3057\u304c\u3088\u308a\u660e\u78ba\u306b\u306a\u308b\u540d\u524d\u4ed8\u304d\u5f15\u6570\u3082\u5c0e\u5165\u3055\u308c\u307e\u3057\u305f\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ PHP 8.0\u4ee5\u964d - \u540d\u524d\u4ed8\u304d\u5f15\u6570\n$parts = preg_split(\n    pattern: '\/[,;]\/',\n    subject: 'apple,orange;banana',\n    flags: PREG_SPLIT_NO_EMPTY\n);\n\n\/\/ \u7279\u5b9a\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3060\u3051\u3092\u6307\u5b9a\uff08\u9806\u5e8f\u3092\u6c17\u306b\u3057\u306a\u3044\uff09\n$html = explode(\n    separator: '&lt;br&gt;',\n    string: $content,\n    limit: 5\n);\n<\/pre>\n\n\n\n<p>\u540d\u524d\u4ed8\u304d\u5f15\u6570\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u7279\u306b\u8907\u6570\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6301\u3064\u95a2\u6570\uff08\u4f8b\uff1a<code>preg_split()<\/code>\uff09\u306e\u53ef\u8aad\u6027\u304c\u5927\u5e45\u306b\u5411\u4e0a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-56\">\u5f93\u6765\u306e\u5206\u5272\u65b9\u6cd5\u3068\u6bd4\u8f03\u3057\u305f\u6a5f\u80fd\u5f37\u5316\u30dd\u30a4\u30f3\u30c8<\/h3>\n\n\n\n<p>PHP 8.0\u4ee5\u964d\u306e\u6587\u5b57\u5217\u6a5f\u80fd\u306f\u3001\u4ee5\u4e0b\u306e\u70b9\u3067\u5f93\u6765\u306e\u30a2\u30d7\u30ed\u30fc\u30c1\u3088\u308a\u512a\u308c\u3066\u3044\u307e\u3059\uff1a<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-57\">1. \u30b3\u30fc\u30c9\u306e\u7c21\u6f54\u3055\u3068\u53ef\u8aad\u6027<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u4f8b\uff1a\u7279\u5b9a\u306e\u30bb\u30d1\u30ec\u30fc\u30bf\u3067\u6587\u5b57\u5217\u3092\u5206\u5272\u3057\u3001\u6700\u521d\u306e\u90e8\u5206\u3092\u53d6\u5f97\n\n\/\/ PHP 8.0\u4ee5\u964d\n$text = \"name=John&amp;age=25&amp;city=Tokyo\";\nif (str_contains($text, '&amp;')) {\n    $parts = explode('&amp;', $text);\n    $nameParam = $parts[0];\n}\n\n\/\/ PHP 7.4\u4ee5\u524d\n$text = \"name=John&amp;age=25&amp;city=Tokyo\";\nif (strpos($text, '&amp;') !== false) {\n    $parts = explode('&amp;', $text);\n    $nameParam = $parts[0];\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-58\">2. \u30a8\u30e9\u30fc\u51e6\u7406\u306e\u6539\u5584<\/h4>\n\n\n\n<p>PHP 8.0\u4ee5\u964d\u3067\u306f\u3001\u578b\u95a2\u9023\u306e\u30a8\u30e9\u30fc\u304c\u3088\u308a\u660e\u78ba\u306b\u306a\u308a\u3001\u30c7\u30d0\u30c3\u30b0\u304c\u5bb9\u6613\u306b\u306a\u308a\u307e\u3057\u305f\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ PHP 8.0\u4ee5\u964d - \u660e\u78ba\u306a\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\n$result = explode(null, \"test\"); \/\/ TypeError: explode(): Argument #1 ($separator) must be of type string, null given\n\n\/\/ PHP 7.4\u4ee5\u524d - \u66d6\u6627\u306a\u8b66\u544a\n$result = explode(null, \"test\"); \/\/ Warning: explode() expects parameter 1 to be string, null given\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-59\">3. \u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u30b5\u30dd\u30fc\u30c8\u306e\u5411\u4e0a<\/h4>\n\n\n\n<p>PHP 7.4\u3067\u5c0e\u5165\u3055\u308c\u3001PHP 8.0\u4ee5\u964d\u3067\u6539\u5584\u3055\u308c\u305f<code>mb_str_split()<\/code>\u95a2\u6570\u306f\u3001\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u5217\u306e\u5206\u5272\u3092\u3088\u308a\u7c21\u5358\u306b\u884c\u3048\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ PHP 7.4\u4ee5\u964d\n$text = \"\u3053\u3093\u306b\u3061\u306f\u4e16\u754c\";\n$chars = mb_str_split($text);\nprint_r($chars);\n\/*\n\u7d50\u679c:\nArray\n(\n    [0] =&gt; \u3053\n    [1] =&gt; \u3093\n    [2] =&gt; \u306b\n    [3] =&gt; \u3061\n    [4] =&gt; \u306f\n    [5] =&gt; \u4e16\n    [6] =&gt; \u754c\n)\n*\/\n\n\/\/ PHP 7.3\u4ee5\u524d\uff08\u81ea\u4f5c\u95a2\u6570\u304c\u5fc5\u8981\uff09\nfunction mb_str_split_custom($str, $length = 1) {\n    return preg_split('\/(?&lt;=.{' . $length . '})\/u', $str);\n}\n<\/pre>\n\n\n\n<p>PHP 8.0\u4ee5\u964d\u3067\u306f\u3001\u6587\u5b57\u5217\u64cd\u4f5c\u306e\u305f\u3081\u306e\u5f37\u529b\u3067\u76f4\u611f\u7684\u306a\u30c4\u30fc\u30eb\u304c\u3055\u3089\u306b\u5145\u5b9f\u3057\u307e\u3057\u305f\u3002\u5f93\u6765\u306f\u8907\u6570\u306e\u30b9\u30c6\u30c3\u30d7\u3084\u56de\u907f\u7b56\u304c\u5fc5\u8981\u3060\u3063\u305f\u64cd\u4f5c\u3082\u3001\u3088\u308a\u7c21\u6f54\u3067\u8aad\u307f\u3084\u3059\u3044\u30b3\u30fc\u30c9\u3067\u5b9f\u73fe\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002\u7279\u306b\u6587\u5b57\u5217\u306e\u691c\u7d22\u3084\u5206\u5272\u306e\u524d\u51e6\u7406\u306b\u304a\u3044\u3066\u3001\u65b0\u3057\u3044\u95a2\u6570\u306f\u5927\u304d\u306a\u4fa1\u5024\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u3053\u308c\u3089\u306e\u65b0\u6a5f\u80fd\u3082\u6d3b\u7528\u3057\u306a\u304c\u3089\u3001\u6587\u5b57\u5217\u5206\u5272\u306e\u5b9f\u8df5\u7684\u306a\u5fdc\u7528\u4f8b\u3092\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-60\">\u6587\u5b57\u5217\u5206\u5272\u306e\u5b9f\u8df5\u7684\u306a\u5fdc\u7528\u4f8b<\/h2>\n\n\n\n<p>\u6587\u5b57\u5217\u5206\u5272\u306f\u3001\u5b9f\u969b\u306e\u958b\u767a\u73fe\u5834\u3067\u983b\u7e41\u306b\u5fc5\u8981\u3068\u306a\u308b\u64cd\u4f5c\u3067\u3059\u3002\u3053\u3053\u3067\u306f\u3001\u5b9f\u52d9\u3067\u3088\u304f\u906d\u9047\u3059\u308b\u72b6\u6cc1\u5225\u306b\u3001\u6700\u9069\u306a\u6587\u5b57\u5217\u5206\u5272\u30c6\u30af\u30cb\u30c3\u30af\u3068\u305d\u306e\u5fdc\u7528\u4f8b\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u4f8b\u3092\u53c2\u8003\u306b\u3059\u308b\u3053\u3068\u3067\u3001\u52b9\u7387\u7684\u304b\u3064\u5805\u7262\u306a\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u305f\u3081\u306e\u77e5\u8b58\u3092\u6df1\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-61\">CSV\u30c7\u30fc\u30bf\u51e6\u7406\u306b\u304a\u3051\u308b\u52b9\u7387\u7684\u306a\u5206\u5272\u30c6\u30af\u30cb\u30c3\u30af<\/h3>\n\n\n\n<p>CSV\u30d5\u30a1\u30a4\u30eb\u306e\u51e6\u7406\u306f\u3001\u30c7\u30fc\u30bf\u306e\u5165\u51fa\u529b\u306b\u304a\u3044\u3066\u975e\u5e38\u306b\u4e00\u822c\u7684\u306a\u30bf\u30b9\u30af\u3067\u3059\u3002PHP\u306b\u306f\u3001CSV\u30c7\u30fc\u30bf\u3092\u52b9\u7387\u7684\u306b\u51e6\u7406\u3059\u308b\u305f\u3081\u306e\u3044\u304f\u3064\u304b\u306e\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-62\">1. \u5c02\u7528\u95a2\u6570\u3092\u4f7f\u7528\u3057\u305f\u51e6\u7406<\/h4>\n\n\n\n<p>PHP\u306b\u306f\u3001CSV\u30d5\u30a1\u30a4\u30eb\u3092\u51e6\u7406\u3059\u308b\u305f\u3081\u306e\u5c02\u7528\u95a2\u6570\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ CSV\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u3080\n$file = fopen('data.csv', 'r');\nif ($file) {\n    \/\/ \u30d8\u30c3\u30c0\u30fc\u884c\u3092\u53d6\u5f97\n    $headers = fgetcsv($file);\n    \n    \/\/ \u30c7\u30fc\u30bf\u884c\u3092\u51e6\u7406\n    $data = [];\n    while (($row = fgetcsv($file)) !== false) {\n        \/\/ \u30d8\u30c3\u30c0\u30fc\u3092\u30ad\u30fc\u3068\u3057\u3066\u9023\u60f3\u914d\u5217\u3092\u4f5c\u6210\n        $data[] = array_combine($headers, $row);\n    }\n    fclose($file);\n    \n    \/\/ \u7d50\u679c\u3092\u8868\u793a\n    print_r($data);\n}\n<\/pre>\n\n\n\n<p><code>fgetcsv()<\/code>\u306f\u3001\u30a8\u30b9\u30b1\u30fc\u30d7\u3055\u308c\u305f\u533a\u5207\u308a\u6587\u5b57\u3084\u5f15\u7528\u7b26\u3067\u56f2\u307e\u308c\u305f\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u6b63\u3057\u304f\u51e6\u7406\u3059\u308b\u305f\u3081\u3001\u5358\u7d14\u306a<code>explode()<\/code>\u3088\u308a\u4fe1\u983c\u6027\u304c\u9ad8\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-63\">2. \u6587\u5b57\u5217\u3068\u3057\u3066\u306eCSV\u30c7\u30fc\u30bf\u51e6\u7406<\/h4>\n\n\n\n<p>\u6587\u5b57\u5217\u5f62\u5f0f\u306eCSV\u30c7\u30fc\u30bf\u3092\u51e6\u7406\u3059\u308b\u5834\u5408\u306f\u3001<code>str_getcsv()<\/code>\u304c\u4fbf\u5229\u3067\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u6587\u5b57\u5217\u5f62\u5f0f\u306eCSV\u30c7\u30fc\u30bf\n$csvString = \"name,age,city\\nJohn,28,Tokyo\\nMary,32,Osaka\";\n\n\/\/ \u884c\u3054\u3068\u306b\u5206\u5272\n$lines = explode(\"\\n\", $csvString);\n\n\/\/ \u30d8\u30c3\u30c0\u30fc\u884c\u3092\u53d6\u5f97\n$headers = str_getcsv($lines[0]);\n\n\/\/ \u30c7\u30fc\u30bf\u884c\u3092\u51e6\u7406\n$data = [];\nfor ($i = 1; $i &lt; count($lines); $i++) {\n    if (trim($lines[$i]) !== '') {\n        $row = str_getcsv($lines[$i]);\n        $data[] = array_combine($headers, $row);\n    }\n}\n\nprint_r($data);\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-64\">3. \u8907\u96d1\u306aCSV\u306e\u51e6\u7406<\/h4>\n\n\n\n<p>\u4e00\u90e8\u306eCSV\u30d5\u30a1\u30a4\u30eb\u306f\u6a19\u6e96\u5f62\u5f0f\u306b\u5f93\u3063\u3066\u3044\u306a\u3044\u304b\u3001\u30ab\u30b9\u30bf\u30e0\u533a\u5207\u308a\u6587\u5b57\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002\u305d\u306e\u3088\u3046\u306a\u5834\u5408\u306b\u306f\u3001<code>preg_split()<\/code>\u304c\u5f79\u7acb\u3061\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30ab\u30b9\u30bf\u30e0\u533a\u5207\u308a\u6587\u5b57\uff08\u30bb\u30df\u30b3\u30ed\u30f3\u3068\u30bf\u30d6\u306e\u6df7\u5728\uff09\u306eCSV\u30c7\u30fc\u30bf\n$customCsv = \"name;age\\tposition\\nJohn Doe;35\\tManager\\nJane Smith;28\\tDeveloper\";\n\n\/\/ \u884c\u306b\u5206\u5272\n$lines = explode(\"\\n\", $customCsv);\n\n\/\/ \u30ab\u30b9\u30bf\u30e0\u533a\u5207\u308a\u6587\u5b57\u3067\u30d8\u30c3\u30c0\u30fc\u3092\u5206\u5272\n$headers = preg_split('\/[;\\t]+\/', $lines[0]);\n\n\/\/ \u30c7\u30fc\u30bf\u884c\u3092\u51e6\u7406\n$data = [];\nfor ($i = 1; $i &lt; count($lines); $i++) {\n    if (trim($lines[$i]) !== '') {\n        $row = preg_split('\/[;\\t]+\/', $lines[$i]);\n        $data[] = array_combine($headers, $row);\n    }\n}\n\nprint_r($data);\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-65\">4. \u5927\u898f\u6a21CSV\u30d5\u30a1\u30a4\u30eb\u306e\u52b9\u7387\u7684\u306a\u51e6\u7406<\/h4>\n\n\n\n<p>\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3092\u6700\u5c0f\u9650\u306b\u6291\u3048\u306a\u304c\u3089\u5927\u304d\u306aCSV\u30d5\u30a1\u30a4\u30eb\u3092\u51e6\u7406\u3059\u308b\u4f8b\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u5927\u898f\u6a21CSV\u30d5\u30a1\u30a4\u30eb\u306e\u51e6\u7406\n$file = fopen('large_data.csv', 'r');\nif ($file) {\n    \/\/ \u30d8\u30c3\u30c0\u30fc\u884c\u3092\u53d6\u5f97\n    $headers = fgetcsv($file);\n    \n    \/\/ 1\u884c\u305a\u3064\u51e6\u7406\uff08\u30e1\u30e2\u30ea\u52b9\u7387\u304c\u826f\u3044\uff09\n    while (($row = fgetcsv($file)) !== false) {\n        $item = array_combine($headers, $row);\n        \n        \/\/ \u5404\u884c\u306e\u51e6\u7406\u3092\u3053\u3053\u3067\u884c\u3046\n        \/\/ \u4f8b: \u7279\u5b9a\u306e\u6761\u4ef6\u306b\u4e00\u81f4\u3059\u308b\u884c\u3060\u3051\u3092\u51e6\u7406\n        if (isset($item['status']) &amp;&amp; $item['status'] === 'active') {\n            \/\/ \u51e6\u7406...\n            echo \"\u51e6\u7406: {$item['name']}\\n\";\n        }\n    }\n    fclose($file);\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-66\">JSON\u3084XML\u69cb\u9020\u304b\u3089\u306e\u7279\u5b9a\u30c7\u30fc\u30bf\u62bd\u51fa\u6cd5<\/h3>\n\n\n\n<p>JSON\u5f62\u5f0f\u3084XML\u5f62\u5f0f\u306e\u30c7\u30fc\u30bf\u304b\u3089\u306f\u3001\u5c02\u7528\u306e\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u7c21\u5358\u306b\u30c7\u30fc\u30bf\u3092\u62bd\u51fa\u3067\u304d\u307e\u3059\u304c\u3001\u6642\u306b\u306f\u6587\u5b57\u5217\u5206\u5272\u6280\u8853\u3068\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3088\u308a\u67d4\u8edf\u306a\u51e6\u7406\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-67\">1. JSON\u30c7\u30fc\u30bf\u306e\u51e6\u7406<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ JSON\u30c7\u30fc\u30bf\n$jsonString = '{\"users\":[{\"name\":\"Tanaka\",\"age\":28,\"skills\":[\"PHP\",\"JavaScript\",\"MySQL\"]},\n                        {\"name\":\"Suzuki\",\"age\":35,\"skills\":[\"Java\",\"Python\",\"Oracle\"]}]}';\n\n\/\/ JSON\u3092\u30c7\u30b3\u30fc\u30c9\n$data = json_decode($jsonString, true);\n\n\/\/ \u7279\u5b9a\u306e\u30c7\u30fc\u30bf\u3092\u62bd\u51fa\n$skills = [];\nforeach ($data['users'] as $user) {\n    \/\/ \u30b9\u30ad\u30eb\u3092\u62bd\u51fa\u3057\u3066\u7d50\u5408\n    $skills = array_merge($skills, $user['skills']);\n}\n\n\/\/ \u91cd\u8907\u3092\u9664\u53bb\u3057\u3066\u30e6\u30cb\u30fc\u30af\u306a\u30b9\u30ad\u30eb\u306e\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\n$uniqueSkills = array_unique($skills);\nprint_r($uniqueSkills);\n\n\/\/ \u7279\u5b9a\u306e\u6587\u5b57\u5217\u30d1\u30bf\u30fc\u30f3\u3092\u6301\u3064\u30b9\u30ad\u30eb\u3060\u3051\u3092\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\n$databaseSkills = array_filter($uniqueSkills, function($skill) {\n    return str_contains(strtolower($skill), 'sql');\n});\nprint_r($databaseSkills);\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-68\">2. \u5358\u7d14\u306aXML\u51e6\u7406<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ XML\u30c7\u30fc\u30bf\n$xmlString = '&lt;?xml version=\"1.0\"?&gt;\n&lt;users&gt;\n    &lt;user&gt;\n        &lt;name&gt;Yamada&lt;\/name&gt;\n        &lt;email&gt;yamada@example.com&lt;\/email&gt;\n        &lt;role&gt;admin&lt;\/role&gt;\n    &lt;\/user&gt;\n    &lt;user&gt;\n        &lt;name&gt;Sato&lt;\/name&gt;\n        &lt;email&gt;sato@example.com&lt;\/email&gt;\n        &lt;role&gt;user&lt;\/role&gt;\n    &lt;\/user&gt;\n&lt;\/users&gt;';\n\n\/\/ SimpleXML\u3092\u4f7f\u7528\u3057\u3066\u89e3\u6790\n$xml = simplexml_load_string($xmlString);\n\n\/\/ \u7279\u5b9a\u306e\u8981\u7d20\u3092\u62bd\u51fa\n$adminEmails = [];\nforeach ($xml-&gt;user as $user) {\n    if ((string)$user-&gt;role === 'admin') {\n        $adminEmails[] = (string)$user-&gt;email;\n    }\n}\n\nprint_r($adminEmails);\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-69\">3. \u6b63\u898f\u8868\u73fe\u3092\u4f7f\u3063\u305fXML\u30c7\u30fc\u30bf\u306e\u62bd\u51fa<\/h4>\n\n\n\n<p>SimpleXML\u3092\u4f7f\u7528\u3067\u304d\u306a\u3044\u5834\u5408\u3084\u3001\u7279\u5b9a\u306e\u30d1\u30bf\u30fc\u30f3\u3060\u3051\u3092\u62bd\u51fa\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u6b63\u898f\u8868\u73fe\u3068<code>preg_split()<\/code>\u306e\u7d44\u307f\u5408\u308f\u305b\u304c\u5f79\u7acb\u3061\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u5358\u7d14\u306aXML\/HTML\u304b\u3089\u30bf\u30b0\u3068\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u62bd\u51fa\n$html = \"&lt;div&gt;\u3053\u3093\u306b\u3061\u306f&lt;\/div&gt;&lt;p&gt;\u3053\u308c\u306f&lt;b&gt;\u30c6\u30b9\u30c8&lt;\/b&gt;\u3067\u3059&lt;\/p&gt;\";\n\n\/\/ \u30bf\u30b0\u3068\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u5206\u96e2\n$parts = preg_split('\/(&lt;[^&gt;]*&gt;)\/', $html, -1, PREG_SPLIT_DELIM_CAPTURE);\n\n\/\/ \u30bf\u30b0\u3068\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u5206\u985e\n$elements = [];\nforeach ($parts as $part) {\n    if (preg_match('\/^&lt;([a-z]+)\/', $part, $matches)) {\n        $elements[] = ['type' =&gt; 'tag_open', 'tag' =&gt; $matches[1], 'content' =&gt; $part];\n    } elseif (preg_match('\/^&lt;\\\/([a-z]+)\/', $part, $matches)) {\n        $elements[] = ['type' =&gt; 'tag_close', 'tag' =&gt; $matches[1], 'content' =&gt; $part];\n    } elseif (trim($part) !== '') {\n        $elements[] = ['type' =&gt; 'text', 'content' =&gt; $part];\n    }\n}\n\nprint_r($elements);\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-70\">\u30d5\u30a9\u30fc\u30e0\u30c7\u30fc\u30bf\u306e\u51e6\u7406\u3068\u691c\u8a3c\u306b\u304a\u3051\u308b\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/h3>\n\n\n\n<p>Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u306f\u3001\u30d5\u30a9\u30fc\u30e0\u304b\u3089\u9001\u4fe1\u3055\u308c\u305f\u30c7\u30fc\u30bf\u3092\u9069\u5207\u306b\u51e6\u7406\u3059\u308b\u3053\u3068\u304c\u4e0d\u53ef\u6b20\u3067\u3059\u3002\u6587\u5b57\u5217\u5206\u5272\u306f\u3053\u306e\u51e6\u7406\u306b\u304a\u3044\u3066\u91cd\u8981\u306a\u5f79\u5272\u3092\u679c\u305f\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-71\">1. URL\u30a8\u30f3\u30b3\u30fc\u30c9\u3055\u308c\u305f\u30af\u30a8\u30ea\u6587\u5b57\u5217\u306e\u89e3\u6790<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ URL\u30a8\u30f3\u30b3\u30fc\u30c9\u3055\u308c\u305f\u30af\u30a8\u30ea\u6587\u5b57\u5217\n$queryString = \"name=\u5c71\u7530\u592a\u90ce&amp;age=28&amp;interests[]=PHP&amp;interests[]=MySQL\";\n\n\/\/ parse_str()\u3092\u4f7f\u7528\u3057\u3066\u89e3\u6790\nparse_str($queryString, $params);\nprint_r($params);\n\n\/\/ \u624b\u52d5\u3067\u306e\u89e3\u6790\uff08explode\u3092\u4f7f\u7528\uff09\n$pairs = explode('&amp;', $queryString);\n$params2 = [];\nforeach ($pairs as $pair) {\n    $keyValue = explode('=', $pair);\n    if (count($keyValue) === 2) {\n        $key = urldecode($keyValue[0]);\n        $value = urldecode($keyValue[1]);\n        \n        \/\/ \u914d\u5217\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u51e6\u7406\uff08\u4f8b\uff1ainterests[]\uff09\n        if (preg_match('\/^([^\\[]*)\\\\[\\\\]$\/', $key, $matches)) {\n            $arrayKey = $matches[1];\n            if (!isset($params2[$arrayKey])) {\n                $params2[$arrayKey] = [];\n            }\n            $params2[$arrayKey][] = $value;\n        } else {\n            $params2[$key] = $value;\n        }\n    }\n}\nprint_r($params2);\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-72\">2. \u30d5\u30a9\u30fc\u30e0\u30c7\u30fc\u30bf\u306e\u691c\u8a3c\u3068\u6574\u5f62<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ POST\u30c7\u30fc\u30bf\u306e\u691c\u8a3c\u3068\u6574\u5f62\nfunction validateFormData($data) {\n    $validated = [];\n    \n    \/\/ \u540d\u524d\u30d5\u30a3\u30fc\u30eb\u30c9\uff08\u5fc5\u9808\u3001\u6587\u5b57\u5217\uff09\n    if (isset($data['name']) &amp;&amp; trim($data['name']) !== '') {\n        $validated['name'] = trim($data['name']);\n    } else {\n        return ['error' =&gt; '\u540d\u524d\u306f\u5fc5\u9808\u3067\u3059\u3002'];\n    }\n    \n    \/\/ \u30e1\u30fc\u30eb\u30d5\u30a3\u30fc\u30eb\u30c9\uff08\u5fc5\u9808\u3001\u30e1\u30fc\u30eb\u5f62\u5f0f\uff09\n    if (isset($data['email']) &amp;&amp; filter_var($data['email'], FILTER_VALIDATE_EMAIL)) {\n        $validated['email'] = $data['email'];\n    } else {\n        return ['error' =&gt; '\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u304c\u7121\u52b9\u3067\u3059\u3002'];\n    }\n    \n    \/\/ \u96fb\u8a71\u756a\u53f7\uff08\u30aa\u30d7\u30b7\u30e7\u30f3\u3001\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u7d71\u4e00\uff09\n    if (isset($data['phone']) &amp;&amp; trim($data['phone']) !== '') {\n        \/\/ \u6570\u5b57\u4ee5\u5916\u3092\u9664\u53bb\n        $phone = preg_replace('\/[^0-9]\/', '', $data['phone']);\n        \n        \/\/ \u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u7d71\u4e00\uff08\u4f8b\uff1a090-1234-5678\uff09\n        if (strlen($phone) === 11) {\n            $formatted = substr($phone, 0, 3) . '-' . substr($phone, 3, 4) . '-' . substr($phone, 7);\n            $validated['phone'] = $formatted;\n        } else {\n            return ['error' =&gt; '\u96fb\u8a71\u756a\u53f7\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u304c\u7121\u52b9\u3067\u3059\u3002'];\n        }\n    }\n    \n    return $validated;\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$formData = [\n    'name' =&gt; ' \u5c71\u7530 \u592a\u90ce ',  \/\/ \u4f59\u5206\u306a\u7a7a\u767d\u3042\u308a\n    'email' =&gt; 'yamada@example.com',\n    'phone' =&gt; '090-1234-5678'  \/\/ \u30cf\u30a4\u30d5\u30f3\u4ed8\u304d\n];\n\n$result = validateFormData($formData);\nprint_r($result);\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-73\">\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u89e3\u6790\u306b\u304a\u3051\u308b\u6587\u5b57\u5217\u5206\u5272\u306e\u6d3b\u7528\u6cd5<\/h3>\n\n\n\n<p>\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u89e3\u6790\u306f\u3001\u30b7\u30b9\u30c6\u30e0\u76e3\u8996\u3084\u30c7\u30d0\u30c3\u30b0\u306e\u91cd\u8981\u306a\u90e8\u5206\u3067\u3059\u3002PHP\u306e\u6587\u5b57\u5217\u5206\u5272\u6a5f\u80fd\u3092\u4f7f\u3063\u3066\u3001\u69d8\u3005\u306a\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306e\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u3092\u52b9\u7387\u7684\u306b\u51e6\u7406\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-74\">1. \u30a2\u30af\u30bb\u30b9\u30ed\u30b0\u306e\u89e3\u6790<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ Apache\u30a2\u30af\u30bb\u30b9\u30ed\u30b0\u306e\u4f8b\n$logLine = '192.168.1.1 - - [10\/Oct\/2023:13:55:36 +0900] \"GET \/index.php HTTP\/1.1\" 200 2326 \"http:\/\/example.com\/\" \"Mozilla\/5.0 (Windows NT 10.0; Win64; x64)\"';\n\n\/\/ \u6b63\u898f\u8868\u73fe\u3092\u4f7f\u3063\u3066\u5404\u90e8\u5206\u3092\u62bd\u51fa\n$pattern = '\/^(\\S+) \\S+ \\S+ \\[([^:]+):([^\\]]+)\\] \"(\\S+) (.*?) (\\S+)\" (\\d+) (\\d+) \"([^\"]*)\" \"([^\"]*)\"$\/';\npreg_match($pattern, $logLine, $matches);\n\n$logData = [\n    'ip' =&gt; $matches[1],\n    'date' =&gt; $matches[2],\n    'time' =&gt; $matches[3],\n    'method' =&gt; $matches[4],\n    'path' =&gt; $matches[5],\n    'protocol' =&gt; $matches[6],\n    'status' =&gt; $matches[7],\n    'bytes' =&gt; $matches[8],\n    'referer' =&gt; $matches[9],\n    'user_agent' =&gt; $matches[10]\n];\n\nprint_r($logData);\n\n\/\/ \u7279\u5b9a\u306eIP\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u3092\u96c6\u8a08\nfunction countAccessesByIP($logFile) {\n    $ipCounts = [];\n    $handle = fopen($logFile, 'r');\n    if ($handle) {\n        while (($line = fgets($handle)) !== false) {\n            \/\/ \u7c21\u6613\u7684\u306aIP\u62bd\u51fa\uff08\u5148\u982d\u306e\u6570\u5024\u30d1\u30bf\u30fc\u30f3\uff09\n            if (preg_match('\/^(\\d+\\.\\d+\\.\\d+\\.\\d+)\/', $line, $matches)) {\n                $ip = $matches[1];\n                if (!isset($ipCounts[$ip])) {\n                    $ipCounts[$ip] = 0;\n                }\n                $ipCounts[$ip]++;\n            }\n        }\n        fclose($handle);\n    }\n    return $ipCounts;\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-75\">2. \u30a8\u30e9\u30fc\u30ed\u30b0\u306e\u89e3\u6790<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ PHP\u30a8\u30e9\u30fc\u30ed\u30b0\u306e\u4f8b\n$errorLog = \"[10-Oct-2023 14:30:45 Asia\/Tokyo] PHP Warning: Division by zero in \/var\/www\/html\/calc.php on line 15\n[10-Oct-2023 14:31:12 Asia\/Tokyo] PHP Notice: Undefined variable: user in \/var\/www\/html\/profile.php on line 23\";\n\n\/\/ \u884c\u3054\u3068\u306b\u5206\u5272\n$errorLines = explode(\"\\n\", $errorLog);\n\n$errors = [];\nforeach ($errorLines as $line) {\n    if (trim($line) === '') continue;\n    \n    \/\/ \u65e5\u6642\u3068\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u5206\u96e2\n    if (preg_match('\/^\\[(.*?)\\] (.*)$\/', $line, $matches)) {\n        $datetime = $matches[1];\n        $message = $matches[2];\n        \n        \/\/ \u30a8\u30e9\u30fc\u30bf\u30a4\u30d7\u3068\u30d5\u30a1\u30a4\u30eb\u60c5\u5831\u3092\u62bd\u51fa\n        if (preg_match('\/PHP (Warning|Notice|Fatal error): (.*) in (.*) on line (\\d+)\/', $message, $details)) {\n            $errors[] = [\n                'datetime' =&gt; $datetime,\n                'type' =&gt; $details[1],\n                'message' =&gt; $details[2],\n                'file' =&gt; $details[3],\n                'line' =&gt; $details[4]\n            ];\n        }\n    }\n}\n\nprint_r($errors);\n\n\/\/ \u30a8\u30e9\u30fc\u30bf\u30a4\u30d7\u3054\u3068\u306e\u96c6\u8a08\n$errorCounts = [];\nforeach ($errors as $error) {\n    if (!isset($errorCounts[$error['type']])) {\n        $errorCounts[$error['type']] = 0;\n    }\n    $errorCounts[$error['type']]++;\n}\n\nprint_r($errorCounts);\n<\/pre>\n\n\n\n<p>\u6587\u5b57\u5217\u5206\u5272\u3092\u6d3b\u7528\u3057\u305f\u5b9f\u8df5\u7684\u306a\u4f8b\u3092\u898b\u3066\u304d\u307e\u3057\u305f\u304c\u3001\u305d\u308c\u305e\u308c\u306e\u30b7\u30ca\u30ea\u30aa\u3067\u6700\u9069\u306a\u65b9\u6cd5\u3092\u9078\u3076\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002\u30b7\u30f3\u30d7\u30eb\u306a\u533a\u5207\u308a\u6587\u5b57\u306b\u3088\u308b\u5206\u5272\u306b\u306f<code>explode()<\/code>\u3092\u3001\u30d1\u30bf\u30fc\u30f3\u30d9\u30fc\u30b9\u306e\u8907\u96d1\u306a\u5206\u5272\u306b\u306f<code>preg_split()<\/code>\u3092\u3001\u305d\u3057\u3066\u5c02\u7528\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\uff08CSV\u306a\u3069\uff09\u306b\u306f\u5c02\u7528\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b\u306e\u304c\u30d9\u30b9\u30c8\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u6280\u8853\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001\u5b9f\u52d9\u3067\u906d\u9047\u3059\u308b\u3042\u3089\u3086\u308b\u6587\u5b57\u5217\u51e6\u7406\u30bf\u30b9\u30af\u3092\u52b9\u7387\u7684\u306b\u89e3\u6c7a\u3067\u304d\u308b\u3067\u3057\u3087\u3046\u3002\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\uff08\u65e5\u672c\u8a9e\u306a\u3069\uff09\u3092\u6271\u3046\u969b\u306e\u6587\u5b57\u5217\u5206\u5272\u306b\u3064\u3044\u3066\u8a73\u3057\u304f\u898b\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-76\">\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\uff08\u65e5\u672c\u8a9e\u306a\u3069\uff09\u3092\u6271\u3046\u969b\u306e\u6587\u5b57\u5217\u5206\u5272<\/h2>\n\n\n\n<p>\u65e5\u672c\u8a9e\u3001\u4e2d\u56fd\u8a9e\u3001\u97d3\u56fd\u8a9e\u306a\u3069\u306e\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u542b\u3080\u30c6\u30ad\u30b9\u30c8\u3092\u51e6\u7406\u3059\u308b\u5834\u5408\u3001\u901a\u5e38\u306e\u6587\u5b57\u5217\u95a2\u6570\u3067\u306f\u4e88\u671f\u305b\u306c\u554f\u984c\u304c\u767a\u751f\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u306f\u3001\u82f1\u8a9e\u306a\u3069\u306e1\u6587\u5b57\u304c1\u30d0\u30a4\u30c8\u3067\u8868\u73fe\u3055\u308c\u308bASCII\u6587\u5b57\u3068\u7570\u306a\u308a\u3001\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u306f1\u6587\u5b57\u306e\u8868\u73fe\u306b\u8907\u6570\u306e\u30d0\u30a4\u30c8\u3092\u4f7f\u7528\u3059\u308b\u305f\u3081\u3067\u3059\u3002\u3053\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u5217\u3092\u6b63\u3057\u304f\u5206\u5272\u3059\u308b\u305f\u3081\u306e\u624b\u6cd5\u3068\u6ce8\u610f\u70b9\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-77\">mb_split()\u95a2\u6570\u3092\u7528\u3044\u305f\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u5bfe\u5fdc\u5206\u5272\u624b\u6cd5<\/h3>\n\n\n\n<p>PHP\u3067\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u6271\u3046\u306b\u306f\u3001<code>mbstring<\/code>\u62e1\u5f35\u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u63d0\u4f9b\u3059\u308b\u95a2\u6570\u7fa4\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u6587\u5b57\u5217\u5206\u5272\u306b\u304a\u3044\u3066\u306f\u3001<code>mb_split()<\/code>\u95a2\u6570\u304c\u6700\u3082\u57fa\u672c\u7684\u306a\u30c4\u30fc\u30eb\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p><code>mb_split()<\/code>\u95a2\u6570\u306e\u57fa\u672c\u69cb\u6587\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">array mb_split(string $pattern, string $string, int $limit = -1)\n<\/pre>\n\n\n\n<p>\u5404\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5f79\u5272\u306f\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>$pattern<\/strong>\uff08\u5fc5\u9808\uff09: \u5206\u5272\u306b\u4f7f\u7528\u3059\u308b\u6b63\u898f\u8868\u73fe\u30d1\u30bf\u30fc\u30f3\u3002<code>preg_split()<\/code>\u3068\u7570\u306a\u308a\u3001\u30c7\u30ea\u30df\u30bf\uff08\/\u306a\u3069\uff09\u306f\u4e0d\u8981\u3067\u3059\u3002<\/li>\n\n\n\n<li><strong>$string<\/strong>\uff08\u5fc5\u9808\uff09: \u5206\u5272\u5bfe\u8c61\u306e\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u5217\u3002<\/li>\n\n\n\n<li><strong>$limit<\/strong>\uff08\u30aa\u30d7\u30b7\u30e7\u30f3\uff09: \u8fd4\u3055\u308c\u308b\u914d\u5217\u306e\u6700\u5927\u8981\u7d20\u6570\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306f-1\u3067\u3001\u5236\u9650\u306a\u3057\u3092\u610f\u5473\u3057\u307e\u3059\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u57fa\u672c\u7684\u306a\u4f7f\u7528\u4f8b\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ mb_split()\u306e\u57fa\u672c\u7684\u306a\u4f7f\u7528\u4f8b\nmb_internal_encoding('UTF-8'); \/\/ \u5185\u90e8\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092UTF-8\u306b\u8a2d\u5b9a\n\n$text = \"\u3053\u3093\u306b\u3061\u306f\u3001\u4e16\u754c\uff01PHP\u3067\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u6271\u3044\u307e\u3057\u3087\u3046\u3002\";\n\n\/\/ \u53e5\u8aad\u70b9\u3067\u5206\u5272\n$sentences = mb_split('[\u3001\u3002\uff01]', $text);\nprint_r($sentences);\n\/*\n\u7d50\u679c:\nArray\n(\n    [0] =&gt; \u3053\u3093\u306b\u3061\u306f\n    [1] =&gt; \u4e16\u754c\n    [2] =&gt; PHP\u3067\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u6271\u3044\u307e\u3057\u3087\u3046\n    [3] =&gt; \n)\n*\/\n<\/pre>\n\n\n\n<p><code>mb_split()<\/code>\u306f<code>preg_split()<\/code>\u3068\u4f3c\u3066\u3044\u307e\u3059\u304c\u3001\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u6b63\u3057\u304f\u51e6\u7406\u3067\u304d\u308b\u70b9\u304c\u5927\u304d\u306a\u9055\u3044\u3067\u3059\u3002\u305f\u3060\u3057\u3001<code>preg_split()<\/code>\u304c\u6301\u3064\u4e00\u90e8\u306e\u30d5\u30e9\u30b0\uff08<code>PREG_SPLIT_NO_EMPTY<\/code>\u306a\u3069\uff09\u306f\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u5f8c\u51e6\u7406\u304c\u5fc5\u8981\u306b\u306a\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u7a7a\u306e\u8981\u7d20\u3092\u9664\u53bb\u3059\u308b\u4f8b\n$sentences = mb_split('[\u3001\u3002\uff01]', $text);\n$sentences = array_filter($sentences, 'strlen'); \/\/ \u7a7a\u6587\u5b57\u5217\u3092\u9664\u53bb\nprint_r($sentences);\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-78\">\u6587\u5b57\u5316\u3051\u3092\u9632\u3050\u305f\u3081\u306e\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u8a2d\u5b9a<\/h3>\n\n\n\n<p>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u6271\u3046\u969b\u306b\u6700\u3082\u983b\u7e41\u306b\u767a\u751f\u3059\u308b\u554f\u984c\u306e\u4e00\u3064\u304c\u6587\u5b57\u5316\u3051\u3067\u3059\u3002\u3053\u308c\u3092\u9632\u3050\u305f\u3081\u306b\u3001\u9069\u5207\u306a\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u8a2d\u5b9a\u304c\u4e0d\u53ef\u6b20\u3067\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-79\">1. \u30b9\u30af\u30ea\u30d7\u30c8\u306e\u6700\u521d\u3067\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u8a2d\u5b9a\u3059\u308b<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30b9\u30af\u30ea\u30d7\u30c8\u306e\u5192\u982d\u3067\u5185\u90e8\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u8a2d\u5b9a\nmb_internal_encoding('UTF-8');\nmb_http_output('UTF-8');\nmb_language('uni');\nmb_regex_encoding('UTF-8');\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-80\">2. \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u63a5\u7d9a\u6642\u306e\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u8a2d\u5b9a\u3059\u308b<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ MySQL\u306e\u5834\u5408\n$mysqli = new mysqli('localhost', 'user', 'password', 'database');\n$mysqli-&gt;set_charset('utf8mb4'); \/\/ \u7d75\u6587\u5b57\u3082\u30b5\u30dd\u30fc\u30c8\u3059\u308bUTF-8\n\n\/\/ PDO\u306e\u5834\u5408\n$pdo = new PDO(\n    'mysql:host=localhost;dbname=database;charset=utf8mb4',\n    'user',\n    'password',\n    [PDO::MYSQL_ATTR_INIT_COMMAND =&gt; \"SET NAMES utf8mb4\"]\n);\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-81\">3. \u30d5\u30a1\u30a4\u30eb\u64cd\u4f5c\u6642\u306e\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u8003\u616e\u3059\u308b<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30d5\u30a1\u30a4\u30eb\u8aad\u307f\u8fbc\u307f\u6642\u306e\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u5909\u63db\n$content = file_get_contents('japanese_text.txt');\n$utf8Content = mb_convert_encoding($content, 'UTF-8', 'auto');\n\n\/\/ \u30d5\u30a1\u30a4\u30eb\u66f8\u304d\u8fbc\u307f\u6642\u306eBOM\uff08Byte Order Mark\uff09\u8003\u616e\n$file = fopen('output.txt', 'w');\n\/\/ UTF-8 BOM\u3092\u66f8\u304d\u8fbc\u3080\u5834\u5408\uff08Windows\u306e\u4e00\u90e8\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u5fc5\u8981\uff09\nfwrite($file, \"\\xEF\\xBB\\xBF\");\nfwrite($file, $utf8Content);\nfclose($file);\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-82\">4. \u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u306e\u691c\u51fa\u3068\u5909\u63db<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u6587\u5b57\u5217\u306e\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u81ea\u52d5\u691c\u51fa\n$encoding = mb_detect_encoding($text, ['UTF-8', 'SJIS', 'EUC-JP', 'ASCII']);\necho \"\u691c\u51fa\u3055\u308c\u305f\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0: $encoding\\n\";\n\n\/\/ \u5fc5\u8981\u306b\u5fdc\u3058\u3066\u5909\u63db\nif ($encoding !== 'UTF-8') {\n    $text = mb_convert_encoding($text, 'UTF-8', $encoding);\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-83\">UTF-8\u74b0\u5883\u3067\u306e\u6587\u5b57\u5217\u5206\u5272\u306b\u304a\u3051\u308b\u6ce8\u610f\u70b9<\/h3>\n\n\n\n<p>UTF-8\u74b0\u5883\u3067\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u5217\u3092\u5206\u5272\u3059\u308b\u969b\u306b\u306f\u3001\u3044\u304f\u3064\u304b\u306e\u91cd\u8981\u306a\u6ce8\u610f\u70b9\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-84\">1. \u6587\u5b57\u6570\u3068\u30d0\u30a4\u30c8\u6570\u306e\u9055\u3044\u3092\u7406\u89e3\u3059\u308b<\/h4>\n\n\n\n<p>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u74b0\u5883\u3067\u306f\u3001\u6587\u5b57\u6570\u3068\u30d0\u30a4\u30c8\u6570\u304c\u4e00\u81f4\u3057\u307e\u305b\u3093\u3002\u305d\u306e\u305f\u3081\u3001\u6587\u5b57\u4f4d\u7f6e\u306e\u8a08\u7b97\u306b\u306f\u5c02\u7528\u306e\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$text = \"\u3053\u3093\u306b\u3061\u306f\";\necho \"\u6587\u5b57\u6570: \" . mb_strlen($text) . \"\\n\";      \/\/ \u7d50\u679c: 5\necho \"\u30d0\u30a4\u30c8\u6570: \" . strlen($text) . \"\\n\";       \/\/ \u7d50\u679c: 15\uff08UTF-8\u3067\u306f\u65e5\u672c\u8a9e\u306f1\u6587\u5b573\u30d0\u30a4\u30c8\uff09\n\n\/\/ \u6587\u5b57\u4f4d\u7f6e\u3092\u6b63\u3057\u304f\u53d6\u5f97\n$pos = mb_strpos($text, \"\u306b\");\necho \"\u300c\u306b\u300d\u306e\u4f4d\u7f6e: \" . $pos . \"\u6587\u5b57\u76ee\\n\";      \/\/ \u7d50\u679c: 2\n\n\/\/ \u30d0\u30a4\u30c8\u4f4d\u7f6e\u3067\u306f\u306a\u304f\u6587\u5b57\u4f4d\u7f6e\u3067\u90e8\u5206\u6587\u5b57\u5217\u3092\u53d6\u5f97\n$part = mb_substr($text, 0, 3);\necho \"\u6700\u521d\u306e3\u6587\u5b57: \" . $part . \"\\n\";           \/\/ \u7d50\u679c: \u3053\u3093\u306b\n\n\/\/ str_split()\u3092\u4f7f\u3046\u3068\u6587\u5b57\u304c\u58ca\u308c\u308b\n$broken = str_split($text, 3);  \/\/ 3\u30d0\u30a4\u30c8\u305a\u3064\u5206\u5272\nprint_r($broken);               \/\/ \u7d50\u679c: \u58ca\u308c\u305f\u6587\u5b57\u306e\u914d\u5217\uff08\u6b63\u3057\u304f\u8868\u793a\u3055\u308c\u306a\u3044\uff09\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-85\">2. PHP 7.4\u4ee5\u964d: mb_str_split()\u306e\u6d3b\u7528<\/h4>\n\n\n\n<p>PHP 7.4\u3067\u8ffd\u52a0\u3055\u308c\u305f<code>mb_str_split()<\/code>\u95a2\u6570\u306f\u3001\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u5217\u3092\u6587\u5b57\u5358\u4f4d\u3067\u6b63\u3057\u304f\u5206\u5272\u3067\u304d\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ PHP 7.4\u4ee5\u964d\u3067\u5229\u7528\u53ef\u80fd\nif (function_exists('mb_str_split')) {\n    $text = \"\u3053\u3093\u306b\u3061\u306f\u4e16\u754c\";\n    $chars = mb_str_split($text);\n    print_r($chars);\n    \/*\n    \u7d50\u679c:\n    Array\n    (\n        [0] =&gt; \u3053\n        [1] =&gt; \u3093\n        [2] =&gt; \u306b\n        [3] =&gt; \u3061\n        [4] =&gt; \u306f\n        [5] =&gt; \u4e16\n        [6] =&gt; \u754c\n    )\n    *\/\n    \n    \/\/ 2\u6587\u5b57\u305a\u3064\u306b\u5206\u5272\n    $parts = mb_str_split($text, 2);\n    print_r($parts);\n    \/*\n    \u7d50\u679c:\n    Array\n    (\n        [0] =&gt; \u3053\u3093\n        [1] =&gt; \u306b\u3061\n        [2] =&gt; \u306f\u4e16\n        [3] =&gt; \u754c\n    )\n    *\/\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-86\">3. PHP 7.4\u672a\u6e80: \u30ab\u30b9\u30bf\u30e0mb_str_split\u95a2\u6570\u306e\u5b9f\u88c5<\/h4>\n\n\n\n<p>\u53e4\u3044PHP\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u306f\u3001\u72ec\u81ea\u306e\u95a2\u6570\u3092\u4f5c\u6210\u3057\u3066\u5bfe\u5fdc\u3067\u304d\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ PHP 7.4\u672a\u6e80\u3067\u306e\u4ee3\u66ff\u7b56\nfunction mb_str_split_custom($string, $length = 1, $encoding = \"UTF-8\") {\n    if ($length &lt; 1) {\n        return false;\n    }\n    \n    $result = [];\n    $strlen = mb_strlen($string, $encoding);\n    \n    for ($i = 0; $i &lt; $strlen; $i += $length) {\n        $result[] = mb_substr($string, $i, $length, $encoding);\n    }\n    \n    return $result;\n}\n\n$text = \"\u3053\u3093\u306b\u3061\u306f\u4e16\u754c\";\n$chars = mb_str_split_custom($text);\nprint_r($chars);\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-87\">4. \u6b63\u898f\u8868\u73fe\u3092\u4f7f\u3063\u305f\u5358\u6587\u5b57\u5206\u5272<\/h4>\n\n\n\n<p>\u6b63\u898f\u8868\u73fe\u306e<code>u<\/code>\u4fee\u98fe\u5b50\uff08PCRE UTF-8\u30e2\u30fc\u30c9\uff09\u3092\u4f7f\u3046\u3053\u3068\u3067\u3082\u3001\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u6b63\u3057\u304f\u51e6\u7406\u3067\u304d\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u6b63\u898f\u8868\u73fe\u3092\u4f7f\u3063\u305f\u6587\u5b57\u5358\u4f4d\u306e\u5206\u5272\n$text = \"\u3053\u3093\u306b\u3061\u306f\u4e16\u754c\";\n$chars = preg_split('\/\/u', $text, -1, PREG_SPLIT_NO_EMPTY);\nprint_r($chars);\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-88\">\u6587\u5b57\u5316\u3051\u3092\u9632\u3050\u305f\u3081\u306e\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u8a2d\u5b9a<\/h3>\n\n\n\n<p>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u5217\u3092\u6271\u3046\u969b\u306b\u767a\u751f\u3059\u308b\u554f\u984c\u306e\u307b\u3068\u3093\u3069\u306f\u3001\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u306e\u4e0d\u4e00\u81f4\u304c\u539f\u56e0\u3067\u3059\u3002\u4ee5\u4e0b\u306e\u5bfe\u7b56\u3092\u8b1b\u3058\u308b\u3053\u3068\u3067\u3001\u6587\u5b57\u5316\u3051\u3092\u9632\u3052\u307e\u3059\uff1a<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-89\">1. HTML\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3067\u306e\u30e1\u30bf\u30bf\u30b0\u8a2d\u5b9a<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n&lt;head&gt;\n    &lt;meta charset=\"UTF-8\"&gt;\n    &lt;title&gt;\u65e5\u672c\u8a9e\u30bf\u30a4\u30c8\u30eb&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n    &lt;!-- \u30b3\u30f3\u30c6\u30f3\u30c4 --&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-90\">2. PHP\u306eHTTP\u30d8\u30c3\u30c0\u30fc\u8a2d\u5b9a<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ HTTP\u30d8\u30c3\u30c0\u30fc\u3067\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u6307\u5b9a\nheader('Content-Type: text\/html; charset=UTF-8');\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-91\">3. CSV\u30d5\u30a1\u30a4\u30eb\u51fa\u529b\u6642\u306eBOM\uff08Byte Order Mark\uff09\u6dfb\u4ed8<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ UTF-8 BOM\u3092\u4ed8\u4e0e\u3057\u3066Excel\u3067\u3082\u6587\u5b57\u5316\u3051\u3057\u306a\u3044CSV\u3092\u51fa\u529b\nfunction outputCSV($data, $filename = 'export.csv') {\n    header('Content-Type: text\/csv; charset=UTF-8');\n    header('Content-Disposition: attachment; filename=\"' . $filename . '\"');\n    \n    \/\/ UTF-8 BOM\u3092\u51fa\u529b\n    echo \"\\xEF\\xBB\\xBF\";\n    \n    $f = fopen('php:\/\/output', 'w');\n    \n    foreach ($data as $row) {\n        fputcsv($f, $row);\n    }\n    \n    fclose($f);\n    exit;\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-92\">UTF-8\u74b0\u5883\u3067\u306e\u6587\u5b57\u5217\u5206\u5272\u306b\u304a\u3051\u308b\u6ce8\u610f\u70b9<\/h3>\n\n\n\n<p>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u6271\u3046\u969b\u306e\u3088\u304f\u3042\u308b\u843d\u3068\u3057\u7a74\u3068\u3001\u305d\u308c\u3092\u56de\u907f\u3059\u308b\u305f\u3081\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3092\u7d39\u4ecb\u3057\u307e\u3059\uff1a<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-93\">1. \u6587\u5b57\u5217\u9577\u306e\u8a08\u7b97<\/h4>\n\n\n\n<p>\u5e38\u306b<code>mb_strlen()<\/code>\u3092\u4f7f\u7528\u3057\u3066\u6587\u5b57\u6570\u3092\u6570\u3048\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$text = \"\u3053\u3093\u306b\u3061\u306f\";\n$length = mb_strlen($text); \/\/ 5\uff08\u6b63\u3057\u3044\u6587\u5b57\u6570\uff09\n$bytes = strlen($text);     \/\/ 15\uff08\u30d0\u30a4\u30c8\u6570\uff09\n\n\/\/ \u30eb\u30fc\u30d7\u3067\u6587\u5b57\u30921\u3064\u305a\u3064\u51e6\u7406\u3059\u308b\nfor ($i = 0; $i &lt; mb_strlen($text); $i++) {\n    $char = mb_substr($text, $i, 1);\n    echo \"$i \u756a\u76ee\u306e\u6587\u5b57: $char\\n\";\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-94\">2. \u8907\u5408\u7684\u306a\u6587\u5b57\u306e\u51e6\u7406<\/h4>\n\n\n\n<p>\u7d75\u6587\u5b57\u3084\u7d50\u5408\u6587\u5b57\u306a\u3069\u306e\u8907\u5408\u6587\u5b57\u306b\u306f\u7279\u306b\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$text = \"\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d\udc66 \u5bb6\u65cf\u306e\u7d75\u6587\u5b57\"; \/\/ \u5bb6\u65cf\u306e\u7d75\u6587\u5b57\uff08\u8907\u6570\u306e\u6587\u5b57\u304c\u7d50\u5408\u3057\u3066\u3044\u308b\uff09\n$chars = mb_str_split($text);\nprint_r($chars);\n\/\/ \u6ce8\u610f: \u7d75\u6587\u5b57\u306f\u8907\u6570\u306e\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u3067\u69cb\u6210\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001\n\/\/ \u60f3\u5b9a\u901a\u308a\u306b\u5206\u5272\u3055\u308c\u306a\u3044\u5834\u5408\u304c\u3042\u308a\u307e\u3059\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-95\">3. \u30d5\u30a9\u30fc\u30e0\u5165\u529b\u306e\u51e6\u7406<\/h4>\n\n\n\n<p>\u30d5\u30a9\u30fc\u30e0\u304b\u3089\u53d7\u3051\u53d6\u3063\u305f\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u51e6\u7406\u3059\u308b\u5834\u5408\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30d5\u30a9\u30fc\u30e0\u5165\u529b\u306e\u691c\u8a3c\u3068\u6574\u5f62\n$name = $_POST['name'] ?? '';\nif (mb_strlen($name) &lt; 2) {\n    echo \"\u540d\u524d\u306f2\u6587\u5b57\u4ee5\u4e0a\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\";\n} elseif (mb_strlen($name) &gt; 20) {\n    echo \"\u540d\u524d\u306f20\u6587\u5b57\u4ee5\u4e0b\u306b\u3057\u3066\u304f\u3060\u3055\u3044\";\n    $name = mb_substr($name, 0, 20); \/\/ 20\u6587\u5b57\u306b\u5207\u308a\u8a70\u3081\n}\n<\/pre>\n\n\n\n<p>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u306e\u51e6\u7406\u306f\u3001PHP\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306b\u304a\u3044\u3066\u91cd\u8981\u306a\u5074\u9762\u3067\u3059\u3002\u7279\u306b\u65e5\u672c\u8a9e\u3084\u4e2d\u56fd\u8a9e\u306a\u3069\u3092\u6271\u3046Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u306f\u3001\u9069\u5207\u306a\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u95a2\u6570\u306e\u4f7f\u7528\u3068\u6b63\u3057\u3044\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u8a2d\u5b9a\u304c\u4e0d\u53ef\u6b20\u3067\u3059\u3002\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u8003\u616e\u3057\u305f\u6587\u5b57\u5217\u5206\u5272\u306e\u6700\u9069\u5316\u306b\u3064\u3044\u3066\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-96\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u8003\u616e\u3057\u305f\u6587\u5b57\u5217\u5206\u5272\u306e\u6700\u9069\u5316<\/h2>\n\n\n\n<p>\u5927\u898f\u6a21\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3084\u9ad8\u8ca0\u8377\u306eWeb\u30b5\u30fc\u30d3\u30b9\u3067\u306f\u3001\u6587\u5b57\u5217\u51e6\u7406\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u5168\u4f53\u306e\u30b7\u30b9\u30c6\u30e0\u6027\u80fd\u306b\u5927\u304d\u306a\u5f71\u97ff\u3092\u4e0e\u3048\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u7279\u306b\u5927\u91cf\u306e\u30c6\u30ad\u30b9\u30c8\u30c7\u30fc\u30bf\u3092\u51e6\u7406\u3059\u308b\u5834\u5408\u3001\u6700\u9069\u306a\u6587\u5b57\u5217\u5206\u5272\u624b\u6cd5\u3092\u9078\u629e\u3059\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002\u3053\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3084\u51e6\u7406\u901f\u5ea6\u3092\u6700\u9069\u5316\u3059\u308b\u305f\u3081\u306e\u30c6\u30af\u30cb\u30c3\u30af\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-97\">\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3092\u6291\u3048\u305f\u5927\u91cf\u30c6\u30ad\u30b9\u30c8\u306e\u5206\u5272\u624b\u6cd5<\/h3>\n\n\n\n<p>\u5927\u304d\u306a\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u4e00\u5ea6\u306b\u8aad\u307f\u8fbc\u3093\u3067\u51e6\u7406\u3059\u308b\u3068\u3001PHP\u306e\u30e1\u30e2\u30ea\u5236\u9650\u306b\u9054\u3059\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u3067\u306f\u3001\u30e1\u30e2\u30ea\u52b9\u7387\u306e\u826f\u3044\u5206\u5272\u624b\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-98\">1. \u30b9\u30c8\u30ea\u30fc\u30e0\u51e6\u7406\u3068\u30a4\u30c6\u30ec\u30fc\u30bf\u306e\u6d3b\u7528<\/h4>\n\n\n\n<p>\u30d5\u30a1\u30a4\u30eb\u3092\u4e00\u884c\u305a\u3064\u8aad\u307f\u8fbc\u307f\u51e6\u7406\u3059\u308b\u3053\u3068\u3067\u3001\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3092\u6700\u5c0f\u9650\u306b\u6291\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u5927\u304d\u306aCSV\u30d5\u30a1\u30a4\u30eb\u3092\u4f4e\u30e1\u30e2\u30ea\u3067\u51e6\u7406\u3059\u308b\u4f8b\nfunction processLargeCSV($filename, $callback) {\n    $handle = fopen($filename, 'r');\n    if (!$handle) {\n        return false;\n    }\n    \n    \/\/ \u30d8\u30c3\u30c0\u30fc\u884c\u3092\u53d6\u5f97\n    $headers = fgetcsv($handle);\n    \n    \/\/ \u4e00\u884c\u305a\u3064\u51e6\u7406\n    $rowCount = 0;\n    while (($row = fgetcsv($handle)) !== false) {\n        $rowCount++;\n        \n        \/\/ \u5404\u884c\u3092\u9023\u60f3\u914d\u5217\u306b\u5909\u63db\n        $data = array_combine($headers, $row);\n        \n        \/\/ \u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u3067\u51e6\u7406\n        $callback($data, $rowCount);\n    }\n    \n    fclose($handle);\n    return $rowCount;\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$processedCount = processLargeCSV('large_data.csv', function($row, $index) {\n    \/\/ \u5fc5\u8981\u306a\u51e6\u7406\u3092\u884c\u3046\n    if ($row['status'] === 'active') {\n        echo \"Active user found: {$row['name']} (row $index)\\n\";\n    }\n});\n\necho \"Processed $processedCount rows\\n\";\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-99\">2. \u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u3092\u4f7f\u7528\u3057\u305f\u9045\u5ef6\u8a55\u4fa1<\/h4>\n\n\n\n<p>PHP 5.5\u4ee5\u964d\u3067\u306f\u3001\u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u3092\u4f7f\u7528\u3057\u3066\u30e1\u30e2\u30ea\u52b9\u7387\u306e\u826f\u3044\u51e6\u7406\u304c\u53ef\u80fd\u3067\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u3092\u4f7f\u7528\u3057\u3066\u5927\u304d\u306a\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u884c\u3054\u3068\u306b\u5206\u5272\nfunction getLines($file) {\n    $handle = fopen($file, 'r');\n    if (!$handle) {\n        throw new Exception(\"Failed to open file: $file\");\n    }\n    \n    try {\n        while (($line = fgets($handle)) !== false) {\n            yield trim($line);\n        }\n    } finally {\n        fclose($handle);\n    }\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$lineCount = 0;\nforeach (getLines('large_log.txt') as $line) {\n    $lineCount++;\n    \n    \/\/ \u7279\u5b9a\u306e\u30d1\u30bf\u30fc\u30f3\u3092\u542b\u3080\u884c\u306e\u307f\u3092\u51e6\u7406\n    if (strpos($line, 'ERROR') !== false) {\n        $parts = explode(' - ', $line, 3);\n        if (count($parts) &gt;= 3) {\n            echo \"Found error at line $lineCount: {$parts[2]}\\n\";\n        }\n    }\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-100\">3. \u5206\u5272\u51e6\u7406\u306e\u30d0\u30c3\u30c1\u5316<\/h4>\n\n\n\n<p>\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u5c0f\u3055\u306a\u30d0\u30c3\u30c1\u306b\u5206\u3051\u3066\u51e6\u7406\u3059\u308b\u3053\u3068\u3067\u3001\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u306e\u30d4\u30fc\u30af\u3092\u6291\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u5de8\u5927\u306a\u6587\u5b57\u5217\u3092\u5206\u5272\u3057\u3066\u30d0\u30c3\u30c1\u51e6\u7406\u3059\u308b\nfunction processBatchedChunks($string, $chunkSize = 1024, $callback) {\n    $length = strlen($string);\n    $position = 0;\n    $batch = [];\n    $batchSize = 0;\n    $maxBatchSize = 100; \/\/ \u30d0\u30c3\u30c1\u30b5\u30a4\u30ba\u306e\u4e0a\u9650\n    \n    while ($position &lt; $length) {\n        \/\/ \u4e00\u5b9a\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u53d6\u308b\n        $chunk = substr($string, $position, $chunkSize);\n        $position += $chunkSize;\n        \n        \/\/ \u6539\u884c\u3067\u5206\u5272\n        $lines = explode(\"\\n\", $chunk);\n        \n        \/\/ \u6700\u5f8c\u306e\u4e0d\u5b8c\u5168\u306a\u884c\u3092\u6b21\u56de\u306b\u6301\u3061\u8d8a\u3059\uff08\u6700\u5f8c\u306e\u30c1\u30e3\u30f3\u30af\u3092\u9664\u304f\uff09\n        if ($position &lt; $length) {\n            $lastLine = array_pop($lines);\n            $position -= strlen($lastLine);\n        }\n        \n        \/\/ \u30d0\u30c3\u30c1\u306b\u8ffd\u52a0\n        $batch = array_merge($batch, $lines);\n        $batchSize += count($lines);\n        \n        \/\/ \u30d0\u30c3\u30c1\u30b5\u30a4\u30ba\u304c\u4e0a\u9650\u306b\u9054\u3057\u305f\u3089\u51e6\u7406\n        if ($batchSize &gt;= $maxBatchSize || $position &gt;= $length) {\n            $callback($batch);\n            $batch = [];\n            $batchSize = 0;\n        }\n    }\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$largeString = file_get_contents('large_text.txt');\nprocessBatchedChunks($largeString, 4096, function($batch) {\n    echo \"Processing batch of \" . count($batch) . \" lines\\n\";\n    \/\/ \u30d0\u30c3\u30c1\u51e6\u7406...\n});\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-101\">\u30d9\u30f3\u30c1\u30de\u30fc\u30af\u3067\u898b\u308b\u5404\u5206\u5272\u95a2\u6570\u306e\u51e6\u7406\u901f\u5ea6\u6bd4\u8f03<\/h3>\n\n\n\n<p>PHP\u306e\u5404\u6587\u5b57\u5217\u5206\u5272\u95a2\u6570\u306f\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u7279\u6027\u304c\u7570\u306a\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u30d9\u30f3\u30c1\u30de\u30fc\u30af\u4f8b\u3067\u3001\u305d\u308c\u305e\u308c\u306e\u9055\u3044\u3092\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u5404\u5206\u5272\u95a2\u6570\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6bd4\u8f03\nfunction benchmarkSplitFunctions() {\n    \/\/ \u30c6\u30b9\u30c8\u7528\u306e\u5927\u304d\u306a\u6587\u5b57\u5217\u3092\u751f\u6210\n    $string = str_repeat(\"item1,item2,item3,item4,item5\\n\", 10000);\n    \n    $results = [];\n    \n    \/\/ explode()\u306e\u30d9\u30f3\u30c1\u30de\u30fc\u30af\n    $start = microtime(true);\n    $lines = explode(\"\\n\", $string);\n    foreach ($lines as $line) {\n        if (empty($line)) continue;\n        $items = explode(',', $line);\n    }\n    $results['explode'] = microtime(true) - $start;\n    \n    \/\/ str_split()\u306e\u30d9\u30f3\u30c1\u30de\u30fc\u30af\n    $start = microtime(true);\n    $chunks = str_split($string, 1000);\n    foreach ($chunks as $chunk) {\n        $lines = explode(\"\\n\", $chunk);\n        foreach ($lines as $line) {\n            if (empty($line)) continue;\n            $chars = str_split($line, 1);\n        }\n    }\n    $results['str_split'] = microtime(true) - $start;\n    \n    \/\/ preg_split()\u306e\u30d9\u30f3\u30c1\u30de\u30fc\u30af\n    $start = microtime(true);\n    $lines = preg_split('\/\\n\/', $string);\n    foreach ($lines as $line) {\n        if (empty($line)) continue;\n        $items = preg_split('\/,\/', $line);\n    }\n    $results['preg_split'] = microtime(true) - $start;\n    \n    \/\/ strtok()\u306e\u30d9\u30f3\u30c1\u30de\u30fc\u30af\n    $start = microtime(true);\n    $firstToken = strtok($string, \"\\n\");\n    while ($firstToken !== false) {\n        if (!empty($firstToken)) {\n            $secondToken = strtok($firstToken, \",\");\n            while ($secondToken !== false) {\n                \/\/ \u51e6\u7406...\n                $secondToken = strtok(\",\");\n            }\n        }\n        $firstToken = strtok(\"\\n\");\n    }\n    $results['strtok'] = microtime(true) - $start;\n    \n    return $results;\n}\n\n$benchmark = benchmarkSplitFunctions();\narsort($benchmark);\necho \"\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6bd4\u8f03\u7d50\u679c\uff08\u79d2\u6570\u3001\u4f4e\u3044\u307b\u3069\u9ad8\u901f\uff09\uff1a\\n\";\nforeach ($benchmark as $function =&gt; $time) {\n    echo \"$function: \" . sprintf(\"%.6f\", $time) . \" \u79d2\\n\";\n}\n<\/pre>\n\n\n\n<p>\u4e00\u822c\u7684\u306b\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u50be\u5411\u304c\u3042\u308a\u307e\u3059\uff1a<\/p>\n\n\n<div id=\"id-3e418ecb-57a0-462a-8611-4f2334bfbaf0\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u95a2\u6570<\/th><th>\u76f8\u5bfe\u901f\u5ea6<\/th><th>\u30e1\u30e2\u30ea\u52b9\u7387<\/th><th>\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9<\/th><\/tr><\/thead><tbody><tr><td>explode()<\/td><td>\u6700\u901f<\/td><td>\u826f\u597d<\/td><td>\u5358\u7d14\u306a\u533a\u5207\u308a\u6587\u5b57\u3067\u306e\u5206\u5272<\/td><\/tr><tr><td>str_split()<\/td><td>\u9ad8\u901f<\/td><td>\u826f\u597d<\/td><td>\u56fa\u5b9a\u9577\u3067\u306e\u5206\u5272<\/td><\/tr><tr><td>strtok()<\/td><td>\u4e2d\u901f<\/td><td>\u6700\u826f<\/td><td>\u30e1\u30e2\u30ea\u52b9\u7387\u304c\u91cd\u8981\u306a\u9010\u6b21\u51e6\u7406<\/td><\/tr><tr><td>preg_split()<\/td><td>\u4f4e\u901f<\/td><td>\u4e2d\u7a0b\u5ea6<\/td><td>\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u3067\u306e\u5206\u5272<\/td><\/tr><tr><td>mb_split()<\/td><td>\u6700\u4f4e\u901f<\/td><td>\u4e2d\u7a0b\u5ea6<\/td><td>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3067\u306e\u5206\u5272<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"i-102\">\u9ad8\u8ca0\u8377\u74b0\u5883\u3067\u306e\u6587\u5b57\u5217\u51e6\u7406\u306e\u6700\u9069\u5316\u6226\u7565<\/h3>\n\n\n\n<p>\u9ad8\u8ca0\u8377\u74b0\u5883\u3084\u30ea\u30bd\u30fc\u30b9\u304c\u5236\u9650\u3055\u308c\u305f\u74b0\u5883\u3067\u306f\u3001\u4ee5\u4e0b\u306e\u6700\u9069\u5316\u6226\u7565\u304c\u52b9\u679c\u7684\u3067\u3059\uff1a<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-103\">1. \u6b63\u898f\u8868\u73fe\u30d1\u30bf\u30fc\u30f3\u306e\u6700\u9069\u5316<\/h4>\n\n\n\n<p>\u8907\u96d1\u306a\u6b63\u898f\u8868\u73fe\u306f\u51e6\u7406\u901f\u5ea6\u306b\u5927\u304d\u306a\u5f71\u97ff\u3092\u4e0e\u3048\u307e\u3059\u3002\u30d1\u30bf\u30fc\u30f3\u3092\u6700\u9069\u5316\u3059\u308b\u3053\u3068\u3067\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u5411\u4e0a\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u975e\u52b9\u7387\u7684\u306a\u6b63\u898f\u8868\u73fe\n$inefficient = preg_split('\/.*?,\/', $string);\n\n\/\/ \u52b9\u7387\u7684\u306a\u6b63\u898f\u8868\u73fe\n$efficient = preg_split('\/[^,]*,\/', $string);\n\n\/\/ \u975e\u30ad\u30e3\u30d7\u30c1\u30e3\u30b0\u30eb\u30fc\u30d7\u3092\u4f7f\u7528\uff08\u4e0d\u8981\u306a\u30ad\u30e3\u30d7\u30c1\u30e3\u3092\u907f\u3051\u308b\uff09\n$text = \"item1 item2 item3\";\n$inefficient = preg_split('\/(item)(\\d+)\/', $text);\n$efficient = preg_split('\/(?:item)\\d+\/', $text);\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-104\">2. \u9759\u7684\u30ad\u30e3\u30c3\u30b7\u30e5\u306e\u6d3b\u7528<\/h4>\n\n\n\n<p>\u7e70\u308a\u8fd4\u3057\u540c\u3058\u30d1\u30bf\u30fc\u30f3\u3067\u5206\u5272\u3092\u884c\u3046\u5834\u5408\u306f\u3001\u7d50\u679c\u3092\u30ad\u30e3\u30c3\u30b7\u30e5\u3059\u308b\u3053\u3068\u3067\u51e6\u7406\u3092\u9ad8\u901f\u5316\u3067\u304d\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u9759\u7684\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u4f7f\u7528\u3057\u305f\u5206\u5272\u51e6\u7406\nfunction cachedSplit($delimiter, $string) {\n    static $cache = [];\n    \n    \/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u30ad\u30fc\u3092\u751f\u6210\uff08\u533a\u5207\u308a\u6587\u5b57\u3068\u6587\u5b57\u5217\u306e\u30cf\u30c3\u30b7\u30e5\uff09\n    $key = md5($delimiter . '_' . $string);\n    \n    if (!isset($cache[$key])) {\n        $cache[$key] = explode($delimiter, $string);\n        \n        \/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u30b5\u30a4\u30ba\u306e\u5236\u9650\uff08\u30e1\u30e2\u30ea\u5bfe\u7b56\uff09\n        if (count($cache) &gt; 100) {\n            array_shift($cache); \/\/ \u6700\u3082\u53e4\u3044\u30a8\u30f3\u30c8\u30ea\u3092\u524a\u9664\n        }\n    }\n    \n    return $cache[$key];\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$parts1 = cachedSplit(',', \"a,b,c,d\");\n$parts2 = cachedSplit(',', \"a,b,c,d\"); \/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u304b\u3089\u53d6\u5f97\u3055\u308c\u308b\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-105\">3. \u524d\u51e6\u7406\u3068\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u4f5c\u6210<\/h4>\n\n\n\n<p>\u5927\u91cf\u306e\u30c6\u30ad\u30b9\u30c8\u3092\u4f55\u5ea6\u3082\u51e6\u7406\u3059\u308b\u5834\u5408\u306f\u3001\u524d\u51e6\u7406\u3057\u3066\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u3067\u3001\u5f8c\u7d9a\u306e\u51e6\u7406\u3092\u9ad8\u901f\u5316\u3067\u304d\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u9577\u3044\u30c6\u30ad\u30b9\u30c8\u306e\u524d\u51e6\u7406\u3068\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u4f5c\u6210\nfunction preprocessText($text) {\n    $lines = explode(\"\\n\", $text);\n    $index = [];\n    \n    foreach ($lines as $i =&gt; $line) {\n        \/\/ \u884c\u756a\u53f7\u3054\u3068\u306b\u5358\u8a9e\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f5c\u6210\n        $words = explode(' ', $line);\n        foreach ($words as $word) {\n            $word = strtolower(trim($word));\n            if (!empty($word)) {\n                if (!isset($index[$word])) {\n                    $index[$word] = [];\n                }\n                $index[$word][] = $i;\n            }\n        }\n    }\n    \n    return [\n        'lines' =&gt; $lines,\n        'word_index' =&gt; $index\n    ];\n}\n\n\/\/ \u524d\u51e6\u7406\u3055\u308c\u305f\u30c7\u30fc\u30bf\u3092\u4f7f\u3063\u3066\u7279\u5b9a\u306e\u5358\u8a9e\u3092\u691c\u7d22\nfunction findWordLines($processed, $word) {\n    $word = strtolower($word);\n    if (isset($processed['word_index'][$word])) {\n        $results = [];\n        foreach ($processed['word_index'][$word] as $lineIndex) {\n            $results[] = $processed['lines'][$lineIndex];\n        }\n        return $results;\n    }\n    return [];\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$text = file_get_contents('large_document.txt');\n$processed = preprocessText($text);\n\n\/\/ \u9ad8\u901f\u306a\u691c\u7d22\u304c\u53ef\u80fd\u306b\n$linesWithPHP = findWordLines($processed, 'PHP');\n<\/pre>\n\n\n\n<p>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u6700\u5927\u5316\u3059\u308b\u305f\u3081\u306b\u306f\u3001\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u306b\u5408\u308f\u305b\u3066\u6700\u9069\u306a\u5206\u5272\u95a2\u6570\u3068\u30a2\u30d7\u30ed\u30fc\u30c1\u3092\u9078\u629e\u3059\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3068\u51e6\u7406\u901f\u5ea6\u306e\u30d0\u30e9\u30f3\u30b9\u3092\u8003\u616e\u3057\u306a\u304c\u3089\u3001\u6700\u9069\u306a\u624b\u6cd5\u3092\u9078\u3073\u307e\u3057\u3087\u3046\u3002\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u6587\u5b57\u5217\u5206\u5272\u306b\u95a2\u9023\u3059\u308b\u3088\u304f\u3042\u308b\u30a8\u30e9\u30fc\u3068\u305d\u306e\u89e3\u6c7a\u6cd5\u306b\u3064\u3044\u3066\u898b\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-106\">\u3088\u304f\u3042\u308b\u30a8\u30e9\u30fc\u3068\u305d\u306e\u89e3\u6c7a\u6cd5<\/h2>\n\n\n\n<p>\u6587\u5b57\u5217\u5206\u5272\u306f\u4e00\u898b\u5358\u7d14\u306a\u64cd\u4f5c\u306b\u898b\u3048\u307e\u3059\u304c\u3001\u5b9f\u969b\u306b\u306f\u69d8\u3005\u306a\u30a8\u30e9\u30fc\u3084\u4e88\u671f\u305b\u306c\u52d5\u4f5c\u306b\u906d\u9047\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001PHP\u306e\u6587\u5b57\u5217\u5206\u5272\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b\u969b\u306b\u3088\u304f\u767a\u751f\u3059\u308b\u30a8\u30e9\u30fc\u3068\u3001\u305d\u306e\u52b9\u679c\u7684\u306a\u89e3\u6c7a\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-107\">\u300cWarning: explode() expects parameter\u2026\u300d\u30a8\u30e9\u30fc\u306e\u539f\u56e0\u3068\u5bfe\u51e6\u6cd5<\/h3>\n\n\n\n<p><code>explode()<\/code>\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b\u969b\u306b\u6700\u3082\u3088\u304f\u906d\u9047\u3059\u308b\u30a8\u30e9\u30fc\u306e\u4e00\u3064\u304c\u3001\u30d1\u30e9\u30e1\u30fc\u30bf\u306b\u95a2\u3059\u308b\u8b66\u544a\u3067\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-108\">1. \u7a7a\u306e\u533a\u5207\u308a\u6587\u5b57\u30a8\u30e9\u30fc<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30a8\u30e9\u30fc\u4f8b: \u7a7a\u306e\u533a\u5207\u308a\u6587\u5b57\n$string = \"Hello World\";\n$parts = explode(\"\", $string); \/\/ PHP Warning: explode(): Empty delimiter\n<\/pre>\n\n\n\n<p>PHP 7.4\u4ee5\u524d\u3067\u306f\u8b66\u544a\u304c\u8868\u793a\u3055\u308c\u3001PHP 8.0\u4ee5\u964d\u3067\u306f\u81f4\u547d\u7684\u306a\u30a8\u30e9\u30fc\uff08ValueError\uff09\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u89e3\u6c7a\u7b56:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u89e3\u6c7a\u7b561: \u7a7a\u306e\u533a\u5207\u308a\u6587\u5b57\u3092\u56de\u907f\n$string = \"Hello World\";\nif ($delimiter !== \"\") {\n    $parts = explode($delimiter, $string);\n} else {\n    \/\/ \u4ee3\u66ff\u51e6\u7406\uff08\u4f8b: \u4e00\u6587\u5b57\u305a\u3064\u5206\u5272\uff09\n    $parts = str_split($string);\n}\n\n\/\/ \u89e3\u6c7a\u7b562: mb_str_split()\u3092\u4f7f\u7528\u3057\u3066\u6587\u5b57\u5358\u4f4d\u3067\u5206\u5272\nif (function_exists('mb_str_split')) {\n    $parts = mb_str_split($string);\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-109\">2. NULL \u3084\u4e0d\u6b63\u306a\u578b\u306e\u30d1\u30e9\u30e1\u30fc\u30bf<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30a8\u30e9\u30fc\u4f8b: NULL\u306e\u533a\u5207\u308a\u6587\u5b57\n$delimiter = null;\n$string = \"Hello World\";\n$parts = explode($delimiter, $string); \/\/ Warning: explode() expects parameter 1 to be string, null given\n<\/pre>\n\n\n\n<p><strong>\u89e3\u6c7a\u7b56:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u89e3\u6c7a\u7b561: \u578b\u30c1\u30a7\u30c3\u30af\u3068\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\n$delimiter = $delimiter ?? \",\"; \/\/ Null\u5408\u4f53\u6f14\u7b97\u5b50\n$string = $string ?? \"\";\n\n\/\/ \u89e3\u6c7a\u7b562: \u53b3\u683c\u306a\u578b\u30c1\u30a7\u30c3\u30af\uff08PHP 7.0\u4ee5\u964d\uff09\nfunction safeSplit(?string $delimiter, ?string $string): array {\n    if ($delimiter === null || $string === null || $delimiter === \"\") {\n        return [];\n    }\n    return explode($delimiter, $string);\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-110\">3. PHP 8.0\u3067\u306e\u53b3\u683c\u306a\u578b\u30c1\u30a7\u30c3\u30af<\/h4>\n\n\n\n<p>PHP 8.0\u4ee5\u964d\u3067\u306f\u578b\u30c1\u30a7\u30c3\u30af\u304c\u3088\u308a\u53b3\u683c\u306b\u306a\u308a\u3001\u4ee5\u524d\u306f\u8b66\u544a\u3060\u3063\u305f\u3082\u306e\u304cValueError\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ PHP 8.0\u4ee5\u964d\u3067\u306e\u4f8b\u5916\u51e6\u7406\ntry {\n    $parts = explode(null, \"text\");\n} catch (ValueError $e) {\n    echo \"\u30a8\u30e9\u30fc: \" . $e-&gt;getMessage();\n    \/\/ \u30a8\u30e9\u30fc: explode(): Argument #1 ($separator) must be a non-empty string\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-111\">\u7a7a\u6587\u5b57\u5217\u3067\u306esplit\u304c\u5f15\u304d\u8d77\u3053\u3059\u554f\u984c\u3068\u56de\u907f\u7b56<\/h3>\n\n\n\n<p>\u5165\u529b\u6587\u5b57\u5217\u304c\u7a7a\u306e\u5834\u5408\u3084\u3001\u5206\u5272\u7d50\u679c\u306b\u7a7a\u306e\u8981\u7d20\u304c\u542b\u307e\u308c\u308b\u5834\u5408\u306e\u51e6\u7406\u306b\u306f\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-112\">1. \u7a7a\u306e\u5165\u529b\u6587\u5b57\u5217\u306e\u51e6\u7406<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u7a7a\u6587\u5b57\u5217\u3092\u5206\u5272\u3057\u305f\u5834\u5408\n$emptyString = \"\";\n$parts = explode(\",\", $emptyString);\nprint_r($parts);\n\/*\n\u7d50\u679c:\nArray\n(\n    [0] =&gt; \n)\n*\/\n<\/pre>\n\n\n\n<p>\u7a7a\u6587\u5b57\u5217\u3092\u5206\u5272\u3059\u308b\u3068\u3001\u7a7a\u306e\u6587\u5b57\u5217\u3092\u542b\u30801\u8981\u7d20\u306e\u914d\u5217\u304c\u8fd4\u3055\u308c\u307e\u3059\u3002\u3053\u308c\u304c\u671f\u5f85\u3068\u7570\u306a\u308b\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5bfe\u51e6\u3057\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u89e3\u6c7a\u7b56: \u4e8b\u524d\u306b\u7a7a\u6587\u5b57\u5217\u3092\u30c1\u30a7\u30c3\u30af\n$string = \"\";\nif (!empty($string)) {\n    $parts = explode(\",\", $string);\n} else {\n    $parts = [];\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-113\">2. \u5206\u5272\u7d50\u679c\u306b\u542b\u307e\u308c\u308b\u7a7a\u8981\u7d20\u306e\u51e6\u7406<\/h4>\n\n\n\n<p>\u9023\u7d9a\u3057\u305f\u533a\u5207\u308a\u6587\u5b57\u304c\u3042\u308b\u5834\u5408\u3001\u7a7a\u306e\u8981\u7d20\u304c\u7d50\u679c\u306b\u542b\u307e\u308c\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u9023\u7d9a\u3057\u305f\u533a\u5207\u308a\u6587\u5b57\u306e\u4f8b\n$csv = \"field1,,field3,,,field6\";\n$fields = explode(\",\", $csv);\nprint_r($fields);\n\/*\n\u7d50\u679c:\nArray\n(\n    [0] =&gt; field1\n    [1] =&gt; \n    [2] =&gt; field3\n    [3] =&gt; \n    [4] =&gt; \n    [5] =&gt; field6\n)\n*\/\n<\/pre>\n\n\n\n<p><strong>\u89e3\u6c7a\u7b56:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u89e3\u6c7a\u7b561: \u7a7a\u306e\u8981\u7d20\u3092\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\n$csv = \"field1,,field3,,,field6\";\n$fields = explode(\",\", $csv);\n$nonEmptyFields = array_filter($fields, 'strlen');\nprint_r($nonEmptyFields);\n\n\/\/ \u89e3\u6c7a\u7b562: preg_split()\u3067PREG_SPLIT_NO_EMPTY\u30d5\u30e9\u30b0\u3092\u4f7f\u7528\n$fields = preg_split('\/,\/', $csv, -1, PREG_SPLIT_NO_EMPTY);\nprint_r($fields);\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-114\">\u7279\u6b8a\u6587\u5b57\u3084\u30a8\u30b9\u30b1\u30fc\u30d7\u30b7\u30fc\u30b1\u30f3\u30b9\u304c\u7d61\u3080\u5206\u5272\u306e\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0<\/h3>\n\n\n\n<p>\u7279\u6b8a\u6587\u5b57\u3084\u30a8\u30b9\u30b1\u30fc\u30d7\u30b7\u30fc\u30b1\u30f3\u30b9\u3092\u542b\u3080\u6587\u5b57\u5217\u306e\u5206\u5272\u3067\u306f\u3001\u4e88\u671f\u305b\u306c\u52d5\u4f5c\u304c\u767a\u751f\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-115\">1. \u6b63\u898f\u8868\u73fe\u306e\u30e1\u30bf\u6587\u5b57<\/h4>\n\n\n\n<p><code>preg_split()<\/code>\u3067\u6b63\u898f\u8868\u73fe\u306e\u30e1\u30bf\u6587\u5b57\uff08<code>.<\/code>, <code>*<\/code>, <code>+<\/code>, <code>?<\/code>, <code>[<\/code>, <code>]<\/code> \u306a\u3069\uff09\u3092\u533a\u5207\u308a\u6587\u5b57\u3068\u3057\u3066\u4f7f\u7528\u3059\u308b\u5834\u5408\u306f\u3001\u30a8\u30b9\u30b1\u30fc\u30d7\u304c\u5fc5\u8981\u3067\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30a8\u30e9\u30fc\u4f8b: \u30e1\u30bf\u6587\u5b57\u3092\u30a8\u30b9\u30b1\u30fc\u30d7\u3057\u3066\u3044\u306a\u3044\n$text = \"a.b.c\";\n$parts = preg_split('\/\\.\/', $text); \/\/ \u300c.\u300d\u306f\u6b63\u898f\u8868\u73fe\u3067\u306f\u4efb\u610f\u306e1\u6587\u5b57\u3092\u610f\u5473\u3059\u308b\u305f\u3081\n\n\/\/ \u6b63\u3057\u3044\u4f8b: \u30e1\u30bf\u6587\u5b57\u3092\u30a8\u30b9\u30b1\u30fc\u30d7\n$parts = preg_split('\/\\.\/', $text);\n\/\/ \u307e\u305f\u306f\n$parts = preg_split('\/[.]\/', $text);\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-116\">2. \u30a8\u30b9\u30b1\u30fc\u30d7\u30b7\u30fc\u30b1\u30f3\u30b9\u306e\u89e3\u91c8\u306e\u9055\u3044<\/h4>\n\n\n\n<p>\u6587\u5b57\u5217\u30ea\u30c6\u30e9\u30eb\u3067\u306e\u30a8\u30b9\u30b1\u30fc\u30d7\u30b7\u30fc\u30b1\u30f3\u30b9\u3068\u6b63\u898f\u8868\u73fe\u3067\u306e\u30a8\u30b9\u30b1\u30fc\u30d7\u30b7\u30fc\u30b1\u30f3\u30b9\u306f\u89e3\u91c8\u304c\u7570\u306a\u308a\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u6587\u5b57\u5217\u3067\u306e\u30a8\u30b9\u30b1\u30fc\u30d7\u3068\u6b63\u898f\u8868\u73fe\u3067\u306e\u30a8\u30b9\u30b1\u30fc\u30d7\u306e\u9055\u3044\n$text = \"line1\\nline2\\nline3\";\n\n\/\/ \u6587\u5b57\u5217\u30ea\u30c6\u30e9\u30eb\u3067\u306e\u6539\u884c\u6587\u5b57\n$parts1 = explode(\"\\n\", $text);\n\n\/\/ \u6b63\u898f\u8868\u73fe\u3067\u306e\u6539\u884c\u6587\u5b57\n$parts2 = preg_split(\"\/\\n\/\", $text);\n\n\/\/ \u4e8c\u91cd\u30a8\u30b9\u30b1\u30fc\u30d7\u304c\u5fc5\u8981\u306a\u30b1\u30fc\u30b9\n$pattern = \"\\\\n\"; \/\/ PHP\u306e\u6587\u5b57\u5217\u3068\u3057\u3066\u300c\\n\u300d\u3068\u3044\u30462\u6587\u5b57\n$parts3 = preg_split(\"\/$pattern\/\", $text); \/\/ \u52d5\u4f5c\u3057\u306a\u3044\n\n\/\/ \u6b63\u3057\u3044\u65b9\u6cd5\n$pattern = \"\\\\\\\\n\"; \/\/ PHP\u306e\u6587\u5b57\u5217\u3068\u3057\u3066\u300c\\\\n\u300d\u3001\u6b63\u898f\u8868\u73fe\u3068\u3057\u3066\u300c\\n\u300d\n$parts4 = preg_split(\"\/$pattern\/\", $text); \/\/ \u6b63\u3057\u304f\u52d5\u4f5c\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-117\">3. UTF-8\u7279\u6b8a\u6587\u5b57\u3068\u6b63\u898f\u8868\u73fe<\/h4>\n\n\n\n<p>UTF-8\u306e\u7279\u6b8a\u6587\u5b57\u3084\u7d75\u6587\u5b57\u3092\u542b\u3080\u6587\u5b57\u5217\u3092\u5206\u5272\u3059\u308b\u5834\u5408\u306f\u3001\u6b63\u898f\u8868\u73fe\u306eUTF-8\u30e2\u30fc\u30c9\u3092\u4f7f\u7528\u3057\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ UTF-8\u30e2\u30fc\u30c9\uff08u\u30d5\u30e9\u30b0\uff09\u3092\u4f7f\u7528\u3057\u305f\u5206\u5272\n$text = \"\u3053\u3093\u306b\u3061\u306f\ud83d\ude0a\u4e16\u754c\";\n$parts = preg_split('\/\/u', $text, -1, PREG_SPLIT_NO_EMPTY);\nprint_r($parts);\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-118\">4. CSV\u5f62\u5f0f\u306e\u5f15\u7528\u7b26\u3067\u56f2\u307e\u308c\u305f\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u51e6\u7406<\/h4>\n\n\n\n<p>CSV\u5f62\u5f0f\u3067\u306f\u3001\u5f15\u7528\u7b26\u3067\u56f2\u307e\u308c\u305f\u30d5\u30a3\u30fc\u30eb\u30c9\u5185\u306b\u3042\u308b\u533a\u5207\u308a\u6587\u5b57\u3092\u7121\u8996\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u5f15\u7528\u7b26\u3067\u56f2\u307e\u308c\u305f\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u542b\u3080CSV\n$csv = 'field1,\"field2,with,commas\",field3';\n\n\/\/ \u5358\u7d14\u306aexplode()\u3067\u306f\u6b63\u3057\u304f\u5206\u5272\u3067\u304d\u306a\u3044\n$fields = explode(',', $csv); \/\/ \u8aa4\u3063\u305f\u7d50\u679c\n\n\/\/ \u89e3\u6c7a\u7b56: str_getcsv()\u3092\u4f7f\u7528\n$fields = str_getcsv($csv);\nprint_r($fields);\n\/*\n\u7d50\u679c:\nArray\n(\n    [0] =&gt; field1\n    [1] =&gt; field2,with,commas\n    [2] =&gt; field3\n)\n*\/\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-119\">\u4e00\u822c\u7684\u306a\u30c7\u30d0\u30c3\u30b0\u3068\u4e88\u9632\u7b56<\/h3>\n\n\n\n<p>\u6587\u5b57\u5217\u5206\u5272\u306b\u95a2\u9023\u3059\u308b\u554f\u984c\u3092\u9632\u3050\u305f\u3081\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3092\u7d39\u4ecb\u3057\u307e\u3059\uff1a<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-120\">1. \u5165\u529b\u306e\u691c\u8a3c\u3068\u578b\u30c1\u30a7\u30c3\u30af<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">function splitSafely($delimiter, $string) {\n    \/\/ \u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u691c\u8a3c\n    if (!is_string($delimiter) || $delimiter === \"\") {\n        throw new InvalidArgumentException(\"\u533a\u5207\u308a\u6587\u5b57\u306f\u7a7a\u3067\u306a\u3044\u6587\u5b57\u5217\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\");\n    }\n    \n    if (!is_string($string)) {\n        throw new InvalidArgumentException(\"\u5206\u5272\u5bfe\u8c61\u306f\u6587\u5b57\u5217\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\");\n    }\n    \n    \/\/ \u5b89\u5168\u306b\u5206\u5272\n    return explode($delimiter, $string);\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-121\">2. \u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u306e\u305f\u3081\u306e\u30e9\u30c3\u30d1\u30fc\u95a2\u6570<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">function trySplit($delimiter, $string, $default = []) {\n    try {\n        if ($delimiter === \"\" || $string === null) {\n            return $default;\n        }\n        return explode($delimiter, $string);\n    } catch (Throwable $e) {\n        \/\/ \u30a8\u30e9\u30fc\u30ed\u30b0\u8a18\u9332\u3001\u30c7\u30d0\u30c3\u30b0\u60c5\u5831\u306a\u3069\n        error_log(\"\u5206\u5272\u30a8\u30e9\u30fc: \" . $e-&gt;getMessage());\n        return $default;\n    }\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$parts = trySplit(\",\", $potentiallyNullString, []);\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-122\">3. \u30c7\u30d0\u30c3\u30b0\u60c5\u5831\u306e\u53ef\u8996\u5316<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">function debugSplit($delimiter, $string) {\n    echo \"\u533a\u5207\u308a\u6587\u5b57: \" . json_encode($delimiter) . \" (\u578b: \" . gettype($delimiter) . \")\\n\";\n    echo \"\u5bfe\u8c61\u6587\u5b57\u5217: \" . json_encode($string) . \" (\u578b: \" . gettype($string) . \")\\n\";\n    \n    try {\n        $result = explode($delimiter, $string);\n        echo \"\u5206\u5272\u7d50\u679c: \" . json_encode($result) . \" (\u8981\u7d20\u6570: \" . count($result) . \")\\n\";\n        return $result;\n    } catch (Throwable $e) {\n        echo \"\u30a8\u30e9\u30fc: \" . $e-&gt;getMessage() . \"\\n\";\n        return null;\n    }\n}\n<\/pre>\n\n\n\n<p>\u6587\u5b57\u5217\u5206\u5272\u95a2\u9023\u306e\u30a8\u30e9\u30fc\u306f\u3001\u9069\u5207\u306a\u5165\u529b\u691c\u8a3c\u3068\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u306b\u3088\u3063\u3066\u56de\u907f\u3067\u304d\u308b\u30b1\u30fc\u30b9\u304c\u591a\u3044\u3067\u3059\u3002\u7279\u306b\u5927\u898f\u6a21\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u306f\u3001\u3053\u308c\u3089\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3092\u5b9f\u88c5\u3059\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u5805\u7262\u306a\u30b3\u30fc\u30c9\u3092\u5b9f\u73fe\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u3053\u308c\u307e\u3067\u306e\u5b66\u7fd2\u5185\u5bb9\u3092\u7dcf\u5408\u3057\u3066\u3001\u72b6\u6cc1\u5225\u306b\u6700\u9069\u306a\u6587\u5b57\u5217\u5206\u5272\u65b9\u6cd5\u3092\u9078\u629e\u3059\u308b\u305f\u3081\u306e\u30d5\u30ed\u30fc\u30c1\u30e3\u30fc\u30c8\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-123\">\u307e\u3068\u3081\uff1a\u72b6\u6cc1\u5225\u30fb\u6700\u9069\u306a\u6587\u5b57\u5217\u5206\u5272\u65b9\u6cd5\u306e\u9078\u629e\u30d5\u30ed\u30fc\u30c1\u30e3\u30fc\u30c8<\/h2>\n\n\n\n<p>\u3053\u3053\u307e\u3067PHP\u306e\u6587\u5b57\u5217\u5206\u5272\u95a2\u6570\u306b\u3064\u3044\u3066\u8a73\u3057\u304f\u89e3\u8aac\u3057\u3066\u304d\u307e\u3057\u305f\u3002\u591a\u69d8\u306a\u6a5f\u80fd\u3068\u7279\u6027\u3092\u6301\u3064\u3053\u308c\u3089\u306e\u95a2\u6570\u3092\u3001\u72b6\u6cc1\u306b\u5fdc\u3058\u3066\u9069\u5207\u306b\u9078\u629e\u3059\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002\u3053\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u6700\u9069\u306a\u6587\u5b57\u5217\u5206\u5272\u65b9\u6cd5\u3092\u9078\u3076\u305f\u3081\u306e\u610f\u601d\u6c7a\u5b9a\u30d7\u30ed\u30bb\u30b9\u3068\u305d\u306e\u5b9f\u52d9\u3078\u306e\u5fdc\u7528\u30dd\u30a4\u30f3\u30c8\u3092\u307e\u3068\u3081\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-124\">\u5206\u5272\u3057\u305f\u3044\u5185\u5bb9\u306b\u5fdc\u3058\u305f\u95a2\u6570\u9078\u629e\u306e\u610f\u601d\u6c7a\u5b9a\u30d7\u30ed\u30bb\u30b9<\/h3>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u30d5\u30ed\u30fc\u30c1\u30e3\u30fc\u30c8\u3092\u53c2\u8003\u306b\u3001\u3042\u306a\u305f\u306e\u72b6\u6cc1\u306b\u6700\u9069\u306a\u6587\u5b57\u5217\u5206\u5272\u95a2\u6570\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\uff08\u65e5\u672c\u8a9e\u306a\u3069\uff09\u3092\u6271\u3044\u307e\u3059\u304b\uff1f<\/strong>\n<ul class=\"wp-block-list\">\n<li><strong>\u306f\u3044<\/strong> \u2192 2\u3078\u9032\u3080<\/li>\n\n\n\n<li><strong>\u3044\u3044\u3048<\/strong> \u2192 3\u3078\u9032\u3080<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u3069\u306e\u3088\u3046\u306a\u57fa\u6e96\u3067\u5206\u5272\u3057\u307e\u3059\u304b\uff1f<\/strong>\n<ul class=\"wp-block-list\">\n<li><strong>\u56fa\u5b9a\u9577\uff08\u6587\u5b57\u6570\uff09\u3067\u5206\u5272<\/strong> \u2192 <code>mb_str_split()<\/code> (PHP 7.4\u4ee5\u964d)<\/li>\n\n\n\n<li><strong>\u6b63\u898f\u8868\u73fe\u30d1\u30bf\u30fc\u30f3\u3067\u5206\u5272<\/strong> \u2192 <code>mb_split()<\/code><\/li>\n\n\n\n<li><strong>\u5358\u7d14\u306a\u533a\u5207\u308a\u6587\u5b57\u3067\u5206\u5272<\/strong> \u2192 <code>explode()<\/code> (\u533a\u5207\u308a\u6587\u5b57\u304c\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u5206\u65ad\u3057\u306a\u3044\u5834\u5408)<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u3069\u306e\u3088\u3046\u306a\u57fa\u6e96\u3067\u5206\u5272\u3057\u307e\u3059\u304b\uff1f<\/strong>\n<ul class=\"wp-block-list\">\n<li><strong>\u56fa\u5b9a\u9577\uff08\u30d0\u30a4\u30c8\u6570\uff09\u3067\u5206\u5272<\/strong> \u2192 <code>str_split()<\/code><\/li>\n\n\n\n<li><strong>\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u3067\u5206\u5272<\/strong> \u2192 4\u3078\u9032\u3080<\/li>\n\n\n\n<li><strong>\u5358\u7d14\u306a\u533a\u5207\u308a\u6587\u5b57\u3067\u5206\u5272<\/strong> \u2192 <code>explode()<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u306e\u7a2e\u985e\u306f\uff1f<\/strong>\n<ul class=\"wp-block-list\">\n<li><strong>\u8907\u6570\u306e\u533a\u5207\u308a\u6587\u5b57<\/strong> \u2192 <code>preg_split('\/[,;\\t]\/', $string)<\/code><\/li>\n\n\n\n<li><strong>\u4f4d\u7f6e\u3084\u6761\u4ef6\u306b\u57fa\u3065\u304f\u5206\u5272<\/strong> \u2192 <code>preg_split()<\/code> + \u9069\u5207\u306a\u6b63\u898f\u8868\u73fe<\/li>\n\n\n\n<li><strong>\u7a7a\u8981\u7d20\u3092\u9664\u5916\u3057\u305f\u3044<\/strong> \u2192 <code>preg_split()<\/code> + <code>PREG_SPLIT_NO_EMPTY<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u51e6\u7406\u3057\u307e\u3059\u304b\uff1f<\/strong>\n<ul class=\"wp-block-list\">\n<li><strong>\u306f\u3044\uff08\u30e1\u30e2\u30ea\u52b9\u7387\u91cd\u8996\uff09<\/strong> \u2192 <code>strtok()<\/code> \u307e\u305f\u306f \u30b9\u30c8\u30ea\u30fc\u30e0\u8aad\u307f\u8fbc\u307f + <code>explode()<\/code><\/li>\n\n\n\n<li><strong>\u3044\u3044\u3048\uff08\u6a5f\u80fd\u6027\u91cd\u8996\uff09<\/strong> \u2192 \u4e0a\u8a18\u3067\u9078\u629e\u3057\u305f\u95a2\u6570<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u8868\u306f\u3001\u5404\u95a2\u6570\u306e\u7279\u6027\u6bd4\u8f03\u3092\u793a\u3057\u3066\u3044\u307e\u3059\uff1a<\/p>\n\n\n<div id=\"id-1a7d92b8-0c2f-4729-8190-494ebbd8bfbe\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u95a2\u6570<\/th><th>\u901f\u5ea6<\/th><th>\u30e1\u30e2\u30ea\u52b9\u7387<\/th><th>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u5bfe\u5fdc<\/th><th>\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3<\/th><th>\u4e3b\u306a\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9<\/th><\/tr><\/thead><tbody><tr><td><code>explode()<\/code><\/td><td>\u2b50\u2b50\u2b50\u2b50\u2b50<\/td><td>\u2b50\u2b50\u2b50\u2b50<\/td><td>\u25b3(\u203b1)<\/td><td>\u2715<\/td><td>\u5358\u7d14\u306a\u533a\u5207\u308a\u6587\u5b57\u3067\u306e\u5206\u5272<\/td><\/tr><tr><td><code>str_split()<\/code><\/td><td>\u2b50\u2b50\u2b50\u2b50<\/td><td>\u2b50\u2b50\u2b50\u2b50<\/td><td>\u2715<\/td><td>\u2715<\/td><td>\u56fa\u5b9a\u9577\uff08\u30d0\u30a4\u30c8\u5358\u4f4d\uff09\u3067\u306e\u5206\u5272<\/td><\/tr><tr><td><code>preg_split()<\/code><\/td><td>\u2b50\u2b50\u2b50<\/td><td>\u2b50\u2b50\u2b50<\/td><td>\u25b3(\u203b2)<\/td><td>\u2b50\u2b50\u2b50\u2b50\u2b50<\/td><td>\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u3067\u306e\u5206\u5272<\/td><\/tr><tr><td><code>mb_split()<\/code><\/td><td>\u2b50\u2b50<\/td><td>\u2b50\u2b50\u2b50<\/td><td>\u2b50\u2b50\u2b50\u2b50\u2b50<\/td><td>\u2b50\u2b50\u2b50\u2b50<\/td><td>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u5217\u306e\u6b63\u898f\u8868\u73fe\u5206\u5272<\/td><\/tr><tr><td><code>mb_str_split()<\/code><\/td><td>\u2b50\u2b50\u2b50<\/td><td>\u2b50\u2b50\u2b50<\/td><td>\u2b50\u2b50\u2b50\u2b50\u2b50<\/td><td>\u2715<\/td><td>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u5217\u306e\u56fa\u5b9a\u9577\u5206\u5272<\/td><\/tr><tr><td><code>strtok()<\/code><\/td><td>\u2b50\u2b50\u2b50<\/td><td>\u2b50\u2b50\u2b50\u2b50\u2b50<\/td><td>\u2715<\/td><td>\u2715<\/td><td>\u30e1\u30e2\u30ea\u52b9\u7387\u304c\u91cd\u8981\u306a\u9010\u6b21\u51e6\u7406<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<p>\u203b1: \u533a\u5207\u308a\u6587\u5b57\u304c\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u5206\u65ad\u3057\u306a\u3044\u5834\u5408\u306f\u4f7f\u7528\u53ef\u80fd<br>\u203b2: \u6b63\u898f\u8868\u73fe\u306e<code>u<\/code>\u30d5\u30e9\u30b0\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067UTF-8\u5bfe\u5fdc\u53ef\u80fd<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-125\">\u5b66\u7fd2\u3057\u305f\u30c6\u30af\u30cb\u30c3\u30af\u306e\u5b9f\u52d9\u3078\u306e\u5fdc\u7528\u30dd\u30a4\u30f3\u30c8<\/h3>\n\n\n\n<p>\u5b9f\u969b\u306e\u958b\u767a\u73fe\u5834\u3067\u6587\u5b57\u5217\u5206\u5272\u6a5f\u80fd\u3092\u52b9\u679c\u7684\u306b\u6d3b\u7528\u3059\u308b\u305f\u3081\u306e\u30dd\u30a4\u30f3\u30c8\u3092\u307e\u3068\u3081\u307e\u3059\uff1a<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-126\">1. \u5805\u7262\u6027\u3092\u9ad8\u3081\u308b\u305f\u3081\u306e\u30e9\u30c3\u30d1\u30fc\u95a2\u6570\u306e\u4f5c\u6210<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u5b89\u5168\u306bexplode()\u3092\u4f7f\u7528\u3059\u308b\u305f\u3081\u306e\u30e9\u30c3\u30d1\u30fc\u95a2\u6570\nfunction safeExplode($delimiter, $string, $limit = PHP_INT_MAX) {\n    \/\/ \u30d1\u30e9\u30e1\u30fc\u30bf\u691c\u8a3c\n    if (!is_string($delimiter) || $delimiter === \"\") {\n        return [$string]; \/\/ \u533a\u5207\u308a\u6587\u5b57\u304c\u7121\u52b9\u306a\u5834\u5408\u306f\u305d\u306e\u307e\u307e\u8fd4\u3059\n    }\n    \n    if (!is_string($string)) {\n        return []; \/\/ \u5206\u5272\u5bfe\u8c61\u304c\u6587\u5b57\u5217\u3067\u306a\u3044\u5834\u5408\u306f\u7a7a\u914d\u5217\u3092\u8fd4\u3059\n    }\n    \n    return explode($delimiter, $string, $limit);\n}\n\n\/\/ \u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u5bfe\u5fdc\u306e\u5206\u5272\u30e9\u30c3\u30d1\u30fc\nfunction safeSplit($string, $length = 1) {\n    if (function_exists('mb_str_split')) {\n        return mb_str_split($string, $length);\n    } else {\n        \/\/ \u4ee3\u66ff\u5b9f\u88c5\uff08PHP 7.4\u672a\u6e80\u7528\uff09\n        $result = [];\n        $strlen = mb_strlen($string);\n        for ($i = 0; $i &lt; $strlen; $i += $length) {\n            $result[] = mb_substr($string, $i, $length);\n        }\n        return $result;\n    }\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-127\">2. \u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3068\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u306e\u30d0\u30e9\u30f3\u30b9<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u9ad8\u901f\u51e6\u7406\u304c\u5fc5\u8981\u306a\u5834\u5408:<\/strong> <code>explode()<\/code>\u3092\u512a\u5148\u3057\u3001\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u524d\u51e6\u7406\u3067\u7c21\u7565\u5316<\/li>\n\n\n\n<li><strong>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u51e6\u7406:<\/strong> \u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u5fdc\u3058\u3066<code>mb_str_split()<\/code>\u307e\u305f\u306f\u81ea\u4f5c\u95a2\u6570\u3092\u4f7f\u7528<\/li>\n\n\n\n<li><strong>\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3:<\/strong> \u6b63\u898f\u8868\u73fe\u306e\u6700\u9069\u5316\u306b\u7559\u610f\u3057\u3064\u3064<code>preg_split()<\/code>\u3092\u6d3b\u7528<\/li>\n\n\n\n<li><strong>\u5927\u91cf\u30c7\u30fc\u30bf\u51e6\u7406:<\/strong> \u30b9\u30c8\u30ea\u30fc\u30e0\u8aad\u307f\u8fbc\u307f\u3068\u7d44\u307f\u5408\u308f\u305b\u3001\u4e00\u5ea6\u306b\u51e6\u7406\u3059\u308b\u30c7\u30fc\u30bf\u91cf\u3092\u5236\u9650<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-128\">3. \u72b6\u6cc1\u306b\u5fdc\u3058\u305f\u6700\u9069\u306a\u7d44\u307f\u5408\u308f\u305b<\/h4>\n\n\n\n<p>\u5b9f\u52d9\u3067\u306f\u3001\u5358\u4e00\u306e\u95a2\u6570\u3060\u3051\u3067\u306a\u304f\u3001\u8907\u6570\u306e\u95a2\u6570\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3088\u308a\u52b9\u679c\u7684\u306a\u51e6\u7406\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ CSV\u30c7\u30fc\u30bf\u306e\u5065\u5168\u306a\u51e6\u7406\u4f8b\nfunction processCSV($csvData) {\n    \/\/ \u884c\u306b\u5206\u5272\n    $lines = explode(\"\\n\", $csvData);\n    \n    \/\/ \u30d8\u30c3\u30c0\u30fc\u884c\u306e\u51e6\u7406\n    $header = str_getcsv(array_shift($lines));\n    \n    $data = [];\n    foreach ($lines as $line) {\n        if (trim($line) === '') continue; \/\/ \u7a7a\u884c\u3092\u30b9\u30ad\u30c3\u30d7\n        \n        \/\/ \u5404\u884c\u3092CSV\u3068\u3057\u3066\u6b63\u3057\u304f\u89e3\u6790\n        $row = str_getcsv($line);\n        \n        \/\/ \u30d8\u30c3\u30c0\u30fc\u3068\u5024\u3092\u9023\u643a\n        $data[] = array_combine($header, $row);\n    }\n    \n    return $data;\n}\n<\/pre>\n\n\n\n<p>\u4eca\u56de\u306e\u8a18\u4e8b\u3067\u7d39\u4ecb\u3057\u305fPHP\u306e\u6587\u5b57\u5217\u5206\u5272\u30c6\u30af\u30cb\u30c3\u30af\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u52b9\u7387\u7684\u3067\u5805\u7262\u306a\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u9069\u5207\u306a\u95a2\u6570\u3092\u9078\u629e\u3057\u3001\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3092\u5b9f\u88c5\u3057\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u6700\u9069\u5316\u3059\u308b\u3053\u3068\u3067\u3001\u3042\u3089\u3086\u308b\u6587\u5b57\u5217\u51e6\u7406\u306e\u30bf\u30b9\u30af\u306b\u5bfe\u5fdc\u3067\u304d\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<p>\u521d\u5fc3\u8005\u304b\u3089\u7d4c\u9a13\u8c4a\u5bcc\u306a\u958b\u767a\u8005\u307e\u3067\u3001\u3053\u306e\u8a18\u4e8b\u304c\u7686\u3055\u3093\u306ePHP\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b9\u30ad\u30eb\u306e\u5411\u4e0a\u306b\u5f79\u7acb\u3066\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Warning: Undefined array key &#8220;is_admin&#8221; in \/home\/xs392991\/dexall.co.jp\/public_html\/articles\/wp-content\/themes\/ &#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,63],"tags":[],"class_list":{"0":"post-3683","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-php","7":"category-php-syntax","8":"nothumb"},"_links":{"self":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts\/3683","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3683"}],"version-history":[{"count":1,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts\/3683\/revisions"}],"predecessor-version":[{"id":3684,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts\/3683\/revisions\/3684"}],"wp:attachment":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}