{"id":3715,"date":"2025-04-15T14:49:44","date_gmt":"2025-04-15T05:49:44","guid":{"rendered":"https:\/\/dexall.co.jp\/articles\/?p=3715"},"modified":"2025-04-15T14:49:46","modified_gmt":"2025-04-15T05:49:46","slug":"%e3%80%90php%e5%85%a5%e9%96%80%e3%80%91%e6%96%87%e5%ad%97%e5%88%97%e6%a4%9c%e7%b4%a2%e3%81%ae%e5%85%a8%e3%83%86%e3%82%af%e3%83%8b%e3%83%83%e3%82%af10%e9%81%b8-%e5%ae%9f%e8%b7%b5%e7%9a%84%e3%81%aa","status":"publish","type":"post","link":"https:\/\/dexall.co.jp\/articles\/?p=3715","title":{"rendered":"\u3010PHP\u5165\u9580\u3011\u6587\u5b57\u5217\u691c\u7d22\u306e\u5168\u30c6\u30af\u30cb\u30c3\u30af10\u9078 &#8211; \u5b9f\u8df5\u7684\u306a\u30b3\u30fc\u30c9\u4f8b\u3068\u6700\u9069\u5316\u624b\u6cd5"},"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\">\u306f\u3058\u3081\u306b\uff1aPHP\u3067\u306e\u6587\u5b57\u5217\u691c\u7d22\u306e\u91cd\u8981\u6027<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-1\">PHP\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306b\u304a\u3051\u308b\u6587\u5b57\u5217\u691c\u7d22\u306e\u7528\u9014<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-2\">\u52b9\u7387\u7684\u306a\u6587\u5b57\u5217\u691c\u7d22\u304c\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306b\u4e0e\u3048\u308b\u5f71\u97ff<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-3\">PHP\u6587\u5b57\u5217\u691c\u7d22\u306e\u57fa\u672c\u6982\u5ff5<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-4\">\u6587\u5b57\u5217\u3068\u306f\u4f55\u304b \u2013 PHP\u306b\u304a\u3051\u308b\u6587\u5b57\u5217\u306e\u53d6\u308a\u6271\u3044<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-5\">\u691c\u7d22\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306e\u57fa\u790e\u77e5\u8b58<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-9\">PHP\u306e\u6a19\u6e96\u95a2\u6570\u3092\u4f7f\u3063\u305f\u57fa\u672c\u7684\u306a\u6587\u5b57\u5217\u691c\u7d22\u30c6\u30af\u30cb\u30c3\u30af<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-10\">strpos()\u3068strrpos()\u3067\u7279\u5b9a\u306e\u6587\u5b57\u5217\u4f4d\u7f6e\u3092\u691c\u7d22\u3059\u308b\u65b9\u6cd5<\/a>      <\/li>      <li>        <a href=\"#i-14\">str_contains()\u95a2\u6570\u306e\u4f7f\u3044\u65b9\uff08PHP 8.0\u4ee5\u964d\uff09<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-15\">strstr()\u3068stristr()\u306b\u3088\u308b\u6587\u5b57\u5217\u691c\u7d22\u3068\u53d6\u5f97<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-19\">\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22\u30c6\u30af\u30cb\u30c3\u30af<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-20\">strtolower()\u3068strtoupper()\u3092\u7d44\u307f\u5408\u308f\u305b\u305f\u691c\u7d22\u65b9\u6cd5<\/a>      <\/li>      <li>        <a href=\"#i-21\">stripos()\u3068strripos()\u306e\u6d3b\u7528\u6cd5<\/a>      <\/li>      <li>        <a href=\"#i-22\">mb_stripos()\u306b\u3088\u308b\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u306e\u691c\u7d22<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-23\">\u30b1\u30fc\u30b9\u30bb\u30f3\u30b7\u30c6\u30a3\u30d6\u691c\u7d22\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6bd4\u8f03<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-24\">\u8907\u6570\u306e\u6587\u5b57\u5217\u30d1\u30bf\u30fc\u30f3\u3092\u4e00\u5ea6\u306b\u691c\u7d22\u3059\u308b\u65b9\u6cd5<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-25\">strpbrk()\u3092\u4f7f\u3063\u305f\u8907\u6570\u6587\u5b57\u691c\u7d22<\/a>      <\/li>      <li>        <a href=\"#i-26\">str_replace()\u3068array_intersect()\u3092\u7d44\u307f\u5408\u308f\u305b\u305f\u30c6\u30af\u30cb\u30c3\u30af<\/a>      <\/li>      <li>        <a href=\"#i-27\">\u914d\u5217\u5185\u306e\u6587\u5b57\u5217\u306b\u5bfe\u3059\u308b\u691c\u7d22\u65b9\u6cd5<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-30\">\u52b9\u7387\u7684\u306a\u8907\u6570\u30d1\u30bf\u30fc\u30f3\u691c\u7d22\u306e\u305f\u3081\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-31\">\u6b63\u898f\u8868\u73fe\u3092\u4f7f\u3063\u305f\u9ad8\u5ea6\u306a\u6587\u5b57\u5217\u691c\u7d22<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-32\">preg_match()\u306e\u57fa\u672c\u3068\u5b9f\u88c5\u4f8b<\/a>      <\/li>      <li>        <a href=\"#i-36\">preg_match_all()\u3067\u8907\u6570\u306e\u30de\u30c3\u30c1\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-39\">\u6b63\u898f\u8868\u73fe\u30d1\u30bf\u30fc\u30f3\u306e\u4f5c\u6210\u30c6\u30af\u30cb\u30c3\u30af<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-47\">\u6587\u5b57\u5217\u691c\u7d22\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-48\">\u5404\u691c\u7d22\u95a2\u6570\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6bd4\u8f03<\/a>      <\/li>      <li>        <a href=\"#i-49\">\u5927\u91cf\u30c6\u30ad\u30b9\u30c8\u51e6\u7406\u306b\u304a\u3051\u308b\u6700\u9069\u5316\u624b\u6cd5<\/a>      <\/li>      <li>        <a href=\"#i-54\">\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3092\u6291\u3048\u305f\u52b9\u7387\u7684\u306a\u691c\u7d22\u5b9f\u88c5<\/a>      <\/li>      <li>        <a href=\"#i-58\">\u5b9f\u969b\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30c6\u30b9\u30c8\u3068\u9078\u629e\u57fa\u6e96<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-61\">\u30ea\u30a2\u30eb\u30ef\u30fc\u30eb\u30c9\u3067\u306e\u6700\u9069\u5316\u4e8b\u4f8b<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-62\">\u5b9f\u8df5\u7684\u306a\u5fdc\u7528\u4f8b\uff1a\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u5225\u306e\u6587\u5b57\u5217\u691c\u7d22\u5b9f\u88c5<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-63\">Web\u30d5\u30a9\u30fc\u30e0\u306e\u5165\u529b\u691c\u8a3c\u306b\u304a\u3051\u308b\u6587\u5b57\u5217\u691c\u7d22<\/a>      <\/li>      <li>        <a href=\"#i-68\">\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u89e3\u6790\u3067\u306e\u52b9\u7387\u7684\u306a\u6587\u5b57\u5217\u691c\u7d22<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-72\">\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u64cd\u4f5c\u524d\u306e\u6587\u5b57\u5217\u30d1\u30bf\u30fc\u30f3\u691c\u7d22\u3068\u51e6\u7406<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-76\">\u6587\u5b57\u5217\u691c\u7d22\u306b\u304a\u3051\u308b\u4e00\u822c\u7684\u306a\u554f\u984c\u3068\u305d\u306e\u89e3\u6c7a\u7b56<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-77\">\u65e5\u672c\u8a9e\u306a\u3069\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3067\u306e\u691c\u7d22\u6642\u306e\u6ce8\u610f\u70b9<\/a>      <\/li>      <li>        <a href=\"#i-83\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30dc\u30c8\u30eb\u30cd\u30c3\u30af\u306e\u7279\u5b9a\u3068\u89e3\u6d88\u6cd5<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-88\">\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30ea\u30b9\u30af\u3092\u8003\u616e\u3057\u305f\u6587\u5b57\u5217\u691c\u7d22\u5b9f\u88c5<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-93\">PHP\u306e\u65b0\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u304a\u3051\u308b\u6587\u5b57\u5217\u691c\u7d22\u6a5f\u80fd\u306e\u9032\u5316<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-94\">PHP 7.x\u304b\u30898.x\u3078\u306e\u6587\u5b57\u5217\u64cd\u4f5c\u306e\u6539\u5584\u70b9<\/a>      <\/li>      <li>        <a href=\"#i-97\">PHP 8.0\u3067\u8ffd\u52a0\u3055\u308c\u305fstr_contains()\u3001str_starts_with()\u3001str_ends_with()<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-102\">\u4eca\u5f8c\u671f\u5f85\u3055\u308c\u308b\u6587\u5b57\u5217\u691c\u7d22\u306e\u65b0\u6a5f\u80fd<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-108\">\u307e\u3068\u3081\uff1a\u52b9\u679c\u7684\u306aPHP\u6587\u5b57\u5217\u691c\u7d22\u30c6\u30af\u30cb\u30c3\u30af\u306e\u9078\u3073\u65b9<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-109\">\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u5225\u304a\u3059\u3059\u3081\u691c\u7d22\u95a2\u6570\u4e00\u89a7<\/a>      <\/li>      <li>        <a href=\"#i-110\">\u6587\u5b57\u5217\u691c\u7d22\u95a2\u6570\u9078\u629e\u306e\u5224\u65ad\u57fa\u6e96<\/a>      <\/li>      <li>        <a href=\"#i-111\">\u3055\u3089\u306a\u308b\u5b66\u7fd2\u30ea\u30bd\u30fc\u30b9\u3068\u53c2\u8003\u60c5\u5831<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-112\">PHP\u3067\u306e\u6587\u5b57\u5217\u691c\u7d22\u30b9\u30ad\u30eb\u3092\u6d3b\u304b\u3059\u5206\u91ce<\/a>      <\/li>    <\/ul>  <\/li>  <li class=\"last\">    <a href=\"#i-113\">\u88dc\u8db3\uff1a\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u307e\u3068\u3081<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-114\">\u3053\u306e\u8a18\u4e8b\u3067\u7d39\u4ecb\u3057\u305f\u5168\u691c\u7d22\u30c6\u30af\u30cb\u30c3\u30af\u306e\u30b3\u30fc\u30c9\u30b9\u30cb\u30da\u30c3\u30c8\u96c6<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-121\">\u5b9f\u884c\u74b0\u5883\u5225\u306e\u52d5\u4f5c\u306e\u9055\u3044\u3068\u6ce8\u610f\u70b9<\/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\">\u306f\u3058\u3081\u306b\uff1aPHP\u3067\u306e\u6587\u5b57\u5217\u691c\u7d22\u306e\u91cd\u8981\u6027<\/h2>\n\n\n\n<p>PHP\u3092\u4f7f\u3063\u305fWeb\u958b\u767a\u3084\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u69cb\u7bc9\u306b\u304a\u3044\u3066\u3001\u6587\u5b57\u5217\u691c\u7d22\u306f\u6700\u3082\u983b\u7e41\u306b\u4f7f\u7528\u3055\u308c\u308b\u64cd\u4f5c\u306e\u4e00\u3064\u3067\u3059\u3002\u30c7\u30fc\u30bf\u306e\u691c\u8a3c\u3001\u51e6\u7406\u3001\u62bd\u51fa\u306a\u3069\u3001\u3042\u3089\u3086\u308b\u5834\u9762\u3067\u6587\u5b57\u5217\u691c\u7d22\u30b9\u30ad\u30eb\u304c\u5fc5\u8981\u3068\u3055\u308c\u307e\u3059\u3002\u672c\u8a18\u4e8b\u3067\u306f\u3001PHP\u306b\u304a\u3051\u308b\u6587\u5b57\u5217\u691c\u7d22\u306e\u57fa\u672c\u304b\u3089\u5fdc\u7528\u307e\u3067\u3001\u5b9f\u8df5\u7684\u306a\u30b3\u30fc\u30c9\u4f8b\u3068\u3068\u3082\u306b\u5fb9\u5e95\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-1\">PHP\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306b\u304a\u3051\u308b\u6587\u5b57\u5217\u691c\u7d22\u306e\u7528\u9014<\/h3>\n\n\n\n<p>PHP\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306b\u304a\u3044\u3066\u3001\u6587\u5b57\u5217\u691c\u7d22\u306f\u591a\u5c90\u306b\u308f\u305f\u308b\u7528\u9014\u3067\u6d3b\u7528\u3055\u308c\u3066\u3044\u307e\u3059\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u306e\u691c\u8a3c<\/strong>\uff1a\u30d5\u30a9\u30fc\u30e0\u304b\u3089\u9001\u4fe1\u3055\u308c\u305f\u30c7\u30fc\u30bf\u306b\u7279\u5b9a\u306e\u6587\u5b57\u3084\u30d1\u30bf\u30fc\u30f3\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u304b\u3092\u78ba\u8a8d<\/li>\n\n\n\n<li><strong>\u30c7\u30fc\u30bf\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0<\/strong>\uff1a\u5927\u91cf\u306e\u30c6\u30ad\u30b9\u30c8\u30c7\u30fc\u30bf\u304b\u3089\u7279\u5b9a\u306e\u60c5\u5831\u3092\u62bd\u51fa<\/li>\n\n\n\n<li><strong>\u30ed\u30b0\u89e3\u6790<\/strong>\uff1a\u30a8\u30e9\u30fc\u30ed\u30b0\u3084\u30a2\u30af\u30bb\u30b9\u30ed\u30b0\u304b\u3089\u7279\u5b9a\u306e\u30a4\u30d9\u30f3\u30c8\u3084\u554f\u984c\u3092\u691c\u51fa<\/li>\n\n\n\n<li><strong>\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u30f3\u30b0<\/strong>\uff1a\u30c6\u30ad\u30b9\u30c8\u5185\u306e\u7279\u5b9a\u306e\u30d1\u30bf\u30fc\u30f3\u3092\u8b58\u5225\uff08E\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3001\u96fb\u8a71\u756a\u53f7\u306a\u3069\uff09<\/li>\n\n\n\n<li><strong>\u30c6\u30ad\u30b9\u30c8\u51e6\u7406<\/strong>\uff1a\u6587\u66f8\u306e\u6574\u5f62\u3084\u5909\u63db\u51e6\u7406\u306b\u304a\u3051\u308b\u7279\u5b9a\u90e8\u5206\u306e\u7279\u5b9a<\/li>\n\n\n\n<li><strong>\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306e\u89e3\u6790<\/strong>\uff1a\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u5185\u306e\u7279\u5b9a\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3084\u5024\u3092\u691c\u7d22<\/li>\n<\/ul>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u64cd\u4f5c\u306f\u3001\u5358\u7d14\u306a\u30d6\u30ed\u30b0\u30b7\u30b9\u30c6\u30e0\u304b\u3089\u8907\u96d1\u306aE\u30b3\u30de\u30fc\u30b9\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u307e\u3067\u3001\u3042\u3089\u3086\u308bPHP\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u57fa\u76e4\u3068\u306a\u308b\u51e6\u7406\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-2\">\u52b9\u7387\u7684\u306a\u6587\u5b57\u5217\u691c\u7d22\u304c\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\u691c\u7d22\u624b\u6cd5\u306e\u9078\u629e\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306b\u76f4\u63a5\u5f71\u97ff\u3057\u307e\u3059\uff1a<\/p>\n\n\n<div id=\"id-b4557aa8-d723-4320-8380-a58dc702f4ef\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u691c\u7d22\u65b9\u6cd5\u306e\u9078\u629e<\/th><th>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3078\u306e\u5f71\u97ff<\/th><\/tr><\/thead><tbody><tr><td>\u6700\u9069\u306a\u95a2\u6570\u9078\u629e<\/td><td>\u51e6\u7406\u901f\u5ea6\u306e\u5927\u5e45\u306a\u5411\u4e0a<\/td><\/tr><tr><td>\u52b9\u7387\u7684\u306a\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0<\/td><td>\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u306e\u524a\u6e1b<\/td><\/tr><tr><td>\u6b63\u898f\u8868\u73fe\u306e\u9069\u5207\u306a\u4f7f\u7528<\/td><td>\u30b5\u30fc\u30d0\u30fc\u8ca0\u8377\u306e\u8efd\u6e1b<\/td><\/tr><tr><td>\u6587\u5b57\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u306e\u8003\u616e<\/td><td>\u56fd\u969b\u5316\u5bfe\u5fdc\u306e\u5186\u6ed1\u5316<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<p>\u4f8b\u3048\u3070\u3001\u5358\u7d14\u306a\u6587\u5b57\u5217\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u304b\u306e\u78ba\u8a8d\u3060\u3051\u3067\u3042\u308c\u3070\u3001\u6b63\u898f\u8868\u73fe\u3088\u308a\u3082<code>strpos()<\/code>\u3084<code>str_contains()<\/code>\u3092\u4f7f\u7528\u3059\u308b\u65b9\u304c\u4f55\u500d\u3082\u9ad8\u901f\u3067\u3059\u3002\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u51e6\u7406\u3059\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u306f\u3001\u3053\u306e\u5dee\u304c\u79d2\u5358\u4f4d\u306e\u30ec\u30b9\u30dd\u30f3\u30b9\u30bf\u30a4\u30e0\u306b\u76f4\u7d50\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=\"\">\/\/ 1000\u4e07\u56de\u306e\u7e70\u308a\u8fd4\u3057\u3067\u306e\u51e6\u7406\u6642\u9593\u6bd4\u8f03\n$text = \"PHP\u3067\u6587\u5b57\u5217\u691c\u7d22\u3092\u5b66\u3076\";\n$search = \"\u6587\u5b57\u5217\";\n\n\/\/ strpos()\u3092\u4f7f\u7528\u3057\u305f\u5834\u5408\n$start = microtime(true);\nfor ($i = 0; $i &lt; 10000000; $i++) {\n    $result = strpos($text, $search) !== false;\n}\necho \"strpos(): \" . (microtime(true) - $start) . \"\u79d2\\n\";\n\n\/\/ preg_match()\u3092\u4f7f\u7528\u3057\u305f\u5834\u5408\n$start = microtime(true);\nfor ($i = 0; $i &lt; 10000000; $i++) {\n    $result = preg_match(\"\/$search\/\", $text);\n}\necho \"preg_match(): \" . (microtime(true) - $start) . \"\u79d2\\n\";\n<\/pre>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306a\u5358\u7d14\u306a\u6bd4\u8f03\u3067\u3082\u3001<code>strpos()<\/code>\u306f\u6b63\u898f\u8868\u73fe\u3092\u4f7f\u7528\u3057\u305f<code>preg_match()<\/code>\u3088\u308a\u3082\u6570\u500d\u9ad8\u901f\u306b\u52d5\u4f5c\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u672c\u8a18\u4e8b\u3067\u306f\u3001\u6587\u5b57\u5217\u691c\u7d22\u306e\u57fa\u790e\u304b\u3089\u5fdc\u7528\u307e\u3067\u3001\u69d8\u3005\u306a\u30c6\u30af\u30cb\u30c3\u30af\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002\u521d\u5fc3\u8005\u306e\u65b9\u306f\u57fa\u672c\u7684\u306a\u95a2\u6570\u306e\u4f7f\u3044\u65b9\u304b\u3089\u3001\u4e2d\u7d1a\u8005\u30fb\u4e0a\u7d1a\u8005\u306e\u65b9\u306f\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316\u3084\u65b0\u6a5f\u80fd\u306e\u6d3b\u7528\u65b9\u6cd5\u307e\u3067\u3001\u5e45\u5e83\u3044\u5185\u5bb9\u3092\u30ab\u30d0\u30fc\u3057\u3066\u3044\u307e\u3059\u3002\u305d\u308c\u305e\u308c\u306e\u30c6\u30af\u30cb\u30c3\u30af\u306e\u7279\u6027\u3068\u4f7f\u3044\u5206\u3051\u3092\u7406\u89e3\u3059\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u52b9\u7387\u7684\u3067\u4fdd\u5b88\u6027\u306e\u9ad8\u3044PHP\u30b3\u30fc\u30c9\u3092\u66f8\u3051\u308b\u3088\u3046\u306b\u306a\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-3\">PHP\u6587\u5b57\u5217\u691c\u7d22\u306e\u57fa\u672c\u6982\u5ff5<\/h2>\n\n\n\n<p>PHP\u3067\u52b9\u679c\u7684\u306a\u6587\u5b57\u5217\u691c\u7d22\u3092\u884c\u3046\u305f\u3081\u306b\u306f\u3001\u307e\u305a\u6587\u5b57\u5217\u306e\u57fa\u672c\u6982\u5ff5\u3068\u3001\u80cc\u5f8c\u306b\u3042\u308b\u691c\u7d22\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306b\u3064\u3044\u3066\u7406\u89e3\u3059\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002\u3053\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001PHP\u3067\u306e\u6587\u5b57\u5217\u306e\u6271\u3044\u65b9\u3068\u691c\u7d22\u306e\u57fa\u672c\u539f\u7406\u306b\u3064\u3044\u3066\u8a73\u3057\u304f\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-4\">\u6587\u5b57\u5217\u3068\u306f\u4f55\u304b \u2013 PHP\u306b\u304a\u3051\u308b\u6587\u5b57\u5217\u306e\u53d6\u308a\u6271\u3044<\/h3>\n\n\n\n<p>PHP\u306b\u304a\u3051\u308b\u6587\u5b57\u5217\u306f\u3001\u4e00\u9023\u306e\u6587\u5b57\u306e\u30b7\u30fc\u30b1\u30f3\u30b9\u3067\u3042\u308a\u3001\u6700\u3082\u57fa\u672c\u7684\u304b\u3064\u983b\u7e41\u306b\u4f7f\u7528\u3055\u308c\u308b\u30c7\u30fc\u30bf\u578b\u306e\u4e00\u3064\u3067\u3059\u3002PHP\u3067\u306f\u6587\u5b57\u5217\u3092\u5b9a\u7fa9\u3059\u308b\u65b9\u6cd5\u304c\u3044\u304f\u3064\u304b\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=\"\">\/\/ \u30b7\u30f3\u30b0\u30eb\u30af\u30a9\u30fc\u30c8\uff08\u30ea\u30c6\u30e9\u30eb\u89e3\u91c8\uff09\n$string1 = '\u3053\u308c\u306fPHP\u306e\u6587\u5b57\u5217\u3067\u3059';\n\n\/\/ \u30c0\u30d6\u30eb\u30af\u30a9\u30fc\u30c8\uff08\u5909\u6570\u5c55\u958b\u3084\u7279\u6b8a\u6587\u5b57\u306e\u30a8\u30b9\u30b1\u30fc\u30d7\u30b7\u30fc\u30b1\u30f3\u30b9\u3092\u89e3\u91c8\uff09\n$language = \"PHP\";\n$string2 = \"\u3053\u308c\u306f{$language}\u306e\u6587\u5b57\u5217\u3067\u3059 \\n \u6539\u884c\u3082\u3067\u304d\u307e\u3059\";\n\n\/\/ \u30d2\u30a2\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\uff08\u8907\u6570\u884c\u306e\u6587\u5b57\u5217\u306b\u6700\u9069\uff09\n$string3 = &lt;&lt;&lt;EOT\n\u3053\u308c\u306f\u8907\u6570\u884c\u306b\u308f\u305f\u308b\n\u9577\u3044\u6587\u5b57\u5217\u3092\n\u6271\u3046\u306e\u306b\u4fbf\u5229\u3067\u3059\nEOT;\n\n\/\/ Nowdoc\uff08\u30d2\u30a2\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u30b7\u30f3\u30b0\u30eb\u30af\u30a9\u30fc\u30c8\u7248\uff09\n$string4 = &lt;&lt;&lt;'EOT'\n\u5909\u6570\u5c55\u958b\u3092\u884c\u308f\u306a\u3044\n\u8907\u6570\u884c\u306e\u6587\u5b57\u5217\u3067\u3059\nEOT;\n<\/pre>\n\n\n\n<p>PHP\u306e\u6587\u5b57\u5217\u306b\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u7279\u5fb4\u304c\u3042\u308a\u307e\u3059\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u30a2\u30af\u30bb\u30b9<\/strong>\uff1a\u6587\u5b57\u5217\u306e\u5404\u6587\u5b57\u306b\u306f0\u304b\u3089\u59cb\u307e\u308b\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3067\u30a2\u30af\u30bb\u30b9\u53ef\u80fd<\/li>\n\n\n\n<li><strong>\u30d0\u30a4\u30c8\u30d9\u30fc\u30b9<\/strong>\uff1a\u6a19\u6e96\u306e\u6587\u5b57\u5217\u95a2\u6570\u306f\u30d0\u30a4\u30c8\u5358\u4f4d\u3067\u52d5\u4f5c\uff08\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u306b\u6ce8\u610f\uff09<\/li>\n\n\n\n<li><strong>\u53ef\u5909\u9577<\/strong>\uff1a\u6587\u5b57\u5217\u306e\u9577\u3055\u306f\u52d5\u7684\u306b\u5909\u66f4\u53ef\u80fd<\/li>\n\n\n\n<li><strong>\u30d0\u30a4\u30ca\u30ea\u30bb\u30fc\u30d5<\/strong>\uff1aNULL\u30d0\u30a4\u30c8\u3092\u542b\u3080\u4efb\u610f\u306e\u30d0\u30a4\u30ca\u30ea\u30c7\u30fc\u30bf\u3092\u683c\u7d0d\u53ef\u80fd<\/li>\n<\/ol>\n\n\n\n<p>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\uff08\u65e5\u672c\u8a9e\u306a\u3069\uff09\u3092\u6271\u3046\u5834\u5408\u306e\u6ce8\u610f\u70b9\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\n\/\/ \u8aa4\u3063\u305f\u9577\u3055\u53d6\u5f97\uff08\u30d0\u30a4\u30c8\u6570\u3092\u8fd4\u3059\uff09\necho strlen($text); \/\/ 15\uff08UTF-8\u3067\u306f\u300c\u3053\u300d\u304c3\u30d0\u30a4\u30c8\u306e\u305f\u3081\uff09\n\n\/\/ \u6b63\u3057\u3044\u6587\u5b57\u6570\u53d6\u5f97\necho mb_strlen($text); \/\/ 5\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-5\">\u691c\u7d22\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306e\u57fa\u790e\u77e5\u8b58<\/h3>\n\n\n\n<p>\u6587\u5b57\u5217\u691c\u7d22\u306e\u80cc\u5f8c\u306b\u306f\u3001\u69d8\u3005\u306a\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u304c\u5b58\u5728\u3057\u307e\u3059\u3002PHP\u306e\u5185\u90e8\u5b9f\u88c5\u3067\u306f\u3053\u308c\u3089\u306e\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u304c\u6700\u9069\u5316\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u57fa\u672c\u7684\u306a\u4ed5\u7d44\u307f\u3092\u7406\u89e3\u3059\u308b\u3053\u3068\u3067\u3001\u9069\u5207\u306a\u95a2\u6570\u9078\u629e\u306b\u5f79\u7acb\u3061\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-6\">\u4e3b\u306a\u6587\u5b57\u5217\u691c\u7d22\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0<\/h4>\n\n\n<div id=\"id-7609a7dd-c890-4fc0-8e4a-53f2ce70e44c\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u540d<\/th><th>\u7279\u5fb4<\/th><th>\u5e73\u5747\u6642\u9593\u8a08\u7b97\u91cf<\/th><th>\u6700\u60aa\u6642\u9593\u8a08\u7b97\u91cf<\/th><\/tr><\/thead><tbody><tr><td>\u30d6\u30eb\u30fc\u30c8\u30d5\u30a9\u30fc\u30b9<\/td><td>\u6700\u3082\u5358\u7d14\u306a\u7dcf\u5f53\u305f\u308a\u691c\u7d22<\/td><td>O(n\u00d7m)<\/td><td>O(n\u00d7m)<\/td><\/tr><tr><td>KMP\uff08Knuth-Morris-Pratt\uff09<\/td><td>\u524d\u56de\u306e\u6bd4\u8f03\u60c5\u5831\u3092\u5229\u7528<\/td><td>O(n+m)<\/td><td>O(n+m)<\/td><\/tr><tr><td>Boyer-Moore<\/td><td>\u30c6\u30ad\u30b9\u30c8\u672b\u5c3e\u304b\u3089\u691c\u7d22\u958b\u59cb<\/td><td>O(n\/m)<\/td><td>O(n\u00d7m)<\/td><\/tr><tr><td>Rabin-Karp<\/td><td>\u30cf\u30c3\u30b7\u30e5\u95a2\u6570\u3092\u5229\u7528<\/td><td>O(n+m)<\/td><td>O(n\u00d7m)<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<p><em>n\uff1a\u30c6\u30ad\u30b9\u30c8\u9577, m\uff1a\u30d1\u30bf\u30fc\u30f3\u9577<\/em><\/p>\n\n\n\n<p>PHP\u5185\u90e8\u3067\u306f\u3001\u3053\u308c\u3089\u306e\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u304c\u6700\u9069\u5316\u3055\u308c\u305f\u5f62\u3067\u5b9f\u88c5\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001<code>strpos()<\/code>\u95a2\u6570\u306f\u5358\u7d14\u306a\u30d6\u30eb\u30fc\u30c8\u30d5\u30a9\u30fc\u30b9\u3067\u306f\u306a\u304f\u3001\u3088\u308a\u52b9\u7387\u7684\u306a\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3092\u7528\u3044\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-7\">\u6587\u5b57\u5217\u691c\u7d22\u306e\u57fa\u672c\u52d5\u4f5c<\/h4>\n\n\n\n<p>PHP\u3067\u306e\u57fa\u672c\u7684\u306a\u6587\u5b57\u5217\u691c\u7d22\u306e\u6d41\u308c\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=\"\">$haystack = \"\u3053\u308c\u306fPHP\u306e\u6587\u5b57\u5217\u691c\u7d22\u306e\u30b5\u30f3\u30d7\u30eb\u30c6\u30ad\u30b9\u30c8\u3067\u3059\";\n$needle = \"\u6587\u5b57\u5217\u691c\u7d22\";\n\n\/\/ \u57fa\u672c\u7684\u306a\u691c\u7d22\u64cd\u4f5c\nif (strpos($haystack, $needle) !== false) {\n    \/\/ \u6587\u5b57\u5217\u304c\u898b\u3064\u304b\u3063\u305f\u5834\u5408\u306e\u51e6\u7406\n    echo \"\u898b\u3064\u304b\u308a\u307e\u3057\u305f\uff01\u4f4d\u7f6e: \" . strpos($haystack, $needle);\n} else {\n    \/\/ \u6587\u5b57\u5217\u304c\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u5834\u5408\u306e\u51e6\u7406\n    echo \"\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\";\n}\n<\/pre>\n\n\n\n<p>\u91cd\u8981\u306a\u30dd\u30a4\u30f3\u30c8\u306f\u3001<code>strpos()<\/code>\u304c\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u5834\u5408\u306b<code>false<\/code>\u3092\u8fd4\u3057\u3001\u6700\u521d\u306e\u6587\u5b57\uff08\u4f4d\u7f6e0\uff09\u3067\u898b\u3064\u304b\u3063\u305f\u5834\u5408\u306b<code>0<\/code>\uff08\u30bc\u30ed\uff09\u3092\u8fd4\u3059\u3053\u3068\u3067\u3059\u3002\u3053\u308c\u304cPHP\u3067\u6587\u5b57\u5217\u691c\u7d22\u3092\u884c\u3046\u969b\u306b\u3001\u5fc5\u305a <code>!== false<\/code> \u306e\u6bd4\u8f03\u304c\u5fc5\u8981\u306a\u7406\u7531\u3067\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-8\">\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3068\u30b9\u30e9\u30a4\u30b9<\/h4>\n\n\n\n<p>\u691c\u7d22\u7d50\u679c\u3092\u5229\u7528\u3057\u3066\u6587\u5b57\u5217\u3092\u64cd\u4f5c\u3059\u308b\u57fa\u672c\u30c6\u30af\u30cb\u30c3\u30af\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 = \"PHP\u6587\u5b57\u5217\u64cd\u4f5c\u306e\u4f8b\u3067\u3059\";\n$pos = mb_strpos($text, \"\u6587\u5b57\u5217\");\n\nif ($pos !== false) {\n    \/\/ \u898b\u3064\u304b\u3063\u305f\u4f4d\u7f6e\u3088\u308a\u524d\u306e\u90e8\u5206\u3092\u53d6\u5f97\n    $before = mb_substr($text, 0, $pos);\n    \n    \/\/ \u898b\u3064\u304b\u3063\u305f\u6587\u5b57\u5217\u306e\u90e8\u5206\n    $found = mb_substr($text, $pos, mb_strlen(\"\u6587\u5b57\u5217\"));\n    \n    \/\/ \u898b\u3064\u304b\u3063\u305f\u4f4d\u7f6e\u3088\u308a\u5f8c\u306e\u90e8\u5206\u3092\u53d6\u5f97\n    $after = mb_substr($text, $pos + mb_strlen(\"\u6587\u5b57\u5217\"));\n    \n    echo \"\u524d: \" . $before . \"\\n\";\n    echo \"\u4e00\u81f4: \" . $found . \"\\n\";\n    echo \"\u5f8c: \" . $after . \"\\n\";\n}\n<\/pre>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306a\u57fa\u672c\u7684\u306a\u8003\u3048\u65b9\u304c\u3001\u3088\u308a\u8907\u96d1\u306a\u6587\u5b57\u5217\u51e6\u7406\u306e\u571f\u53f0\u3068\u306a\u308a\u307e\u3059\u3002\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u304b\u3089\u306f\u3001\u5177\u4f53\u7684\u306a\u691c\u7d22\u95a2\u6570\u3068\u305d\u306e\u30c6\u30af\u30cb\u30c3\u30af\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-9\">PHP\u306e\u6a19\u6e96\u95a2\u6570\u3092\u4f7f\u3063\u305f\u57fa\u672c\u7684\u306a\u6587\u5b57\u5217\u691c\u7d22\u30c6\u30af\u30cb\u30c3\u30af<\/h2>\n\n\n\n<p>PHP\u306b\u306f\u6587\u5b57\u5217\u691c\u7d22\u306e\u305f\u3081\u306e\u6a19\u6e96\u95a2\u6570\u304c\u8c4a\u5bcc\u306b\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u95a2\u6570\u3092\u9069\u5207\u306b\u4f7f\u3044\u5206\u3051\u308b\u3053\u3068\u3067\u3001\u52b9\u7387\u7684\u304b\u3064\u53ef\u8aad\u6027\u306e\u9ad8\u3044\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u3053\u3067\u306f\u3001\u6700\u3082\u57fa\u672c\u7684\u306a\u6587\u5b57\u5217\u691c\u7d22\u95a2\u6570\u306b\u3064\u3044\u3066\u8a73\u3057\u304f\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-10\">strpos()\u3068strrpos()\u3067\u7279\u5b9a\u306e\u6587\u5b57\u5217\u4f4d\u7f6e\u3092\u691c\u7d22\u3059\u308b\u65b9\u6cd5<\/h3>\n\n\n\n<p><code>strpos()<\/code>\u3068<code>strrpos()<\/code>\u306f\u3001PHP\u3067\u6700\u3082\u983b\u7e41\u306b\u4f7f\u7528\u3055\u308c\u308b\u6587\u5b57\u5217\u691c\u7d22\u95a2\u6570\u3067\u3059\u3002\u3053\u308c\u3089\u306f\u6587\u5b57\u5217\u5185\u3067\u7279\u5b9a\u306e\u30d1\u30bf\u30fc\u30f3\u304c\u6700\u521d\u306b\uff08\u307e\u305f\u306f\u6700\u5f8c\u306b\uff09\u51fa\u73fe\u3059\u308b\u4f4d\u7f6e\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-11\">strpos() \u2013 \u6700\u521d\u306e\u51fa\u73fe\u4f4d\u7f6e\u3092\u691c\u7d22<\/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=\"\">\/\/ strpos(\u691c\u7d22\u5bfe\u8c61\u6587\u5b57\u5217, \u63a2\u3059\u6587\u5b57\u5217, [\u958b\u59cb\u4f4d\u7f6e])\n$text = \"PHP\u958b\u767a\u306b\u304a\u3051\u308bPHP\u306e\u6587\u5b57\u5217\u691c\u7d22\u306f\u91cd\u8981\u3067\u3059\";\n$position = strpos($text, \"PHP\", 0); \/\/ \u6700\u521d\u306ePHP\u306e\u4f4d\u7f6e\u3092\u691c\u7d22\necho $position; \/\/ \u51fa\u529b: 0\uff08\u6700\u521d\u306e\u6587\u5b57\u304b\u3089\u59cb\u307e\u308b\u305f\u3081\uff09\n\n\/\/ 2\u756a\u76ee\u306ePHP\u3092\u691c\u7d22\n$position = strpos($text, \"PHP\", 1); \/\/ 1\u6587\u5b57\u76ee\u4ee5\u964d\u304b\u3089\u691c\u7d22\necho $position; \/\/ \u51fa\u529b: 8\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-12\">strrpos() \u2013 \u6700\u5f8c\u306e\u51fa\u73fe\u4f4d\u7f6e\u3092\u691c\u7d22<\/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=\"\">\/\/ strrpos(\u691c\u7d22\u5bfe\u8c61\u6587\u5b57\u5217, \u63a2\u3059\u6587\u5b57\u5217, [\u958b\u59cb\u4f4d\u7f6e])\n$text = \"PHP\u958b\u767a\u306b\u304a\u3051\u308bPHP\u306e\u6587\u5b57\u5217\u691c\u7d22\u306f\u91cd\u8981\u3067\u3059\";\n$position = strrpos($text, \"PHP\"); \/\/ \u6700\u5f8c\u306ePHP\u306e\u4f4d\u7f6e\u3092\u691c\u7d22\necho $position; \/\/ \u51fa\u529b: 8\uff082\u756a\u76ee\u306ePHP\u306e\u4f4d\u7f6e\uff09\n\n\/\/ \u5f8c\u308d\u304b\u3089\u6570\u3048\u305f\u958b\u59cb\u4f4d\u7f6e\u3082\u6307\u5b9a\u53ef\u80fd\uff08\u8ca0\u306e\u5024\uff09\n$position = strrpos($text, \"P\", -5); \/\/ \u672b\u5c3e\u304b\u30895\u6587\u5b57\u524d\u307e\u3067\u306e\u9593\u3067P\u3092\u5f8c\u65b9\u691c\u7d22\necho $position; \/\/ \u6587\u8108\u306b\u3088\u3063\u3066\u7d50\u679c\u306f\u5909\u308f\u308a\u307e\u3059\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-13\">\u91cd\u8981\u306a\u6ce8\u610f\u70b9<\/h4>\n\n\n\n<p><code>strpos()<\/code>\u3068<code>strrpos()<\/code>\u306e\u623b\u308a\u5024\u306f\u691c\u7d22\u5bfe\u8c61\u304c\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u5834\u5408\u306f<code>false<\/code>\u3001\u898b\u3064\u304b\u3063\u305f\u5834\u5408\u306f\u305d\u306e\u4f4d\u7f6e\uff080\u4ee5\u4e0a\u306e\u6574\u6570\uff09\u3092\u8fd4\u3057\u307e\u3059\u3002\u4f4d\u7f6e0\u3067\u898b\u3064\u304b\u3063\u305f\u5834\u5408\u3001PHP\u306e\u7de9\u3044\u6bd4\u8f03\uff08<code>==<\/code>\uff09\u3067\u306f<code>false<\/code>\u3068\u540c\u7b49\u306b\u8a55\u4fa1\u3055\u308c\u308b\u305f\u3081\u3001\u5fc5\u305a\u53b3\u5bc6\u306a\u6bd4\u8f03\uff08<code>!==<\/code>\uff09\u3092\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\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=\"\">$text = \"PHP\u6587\u5b57\u5217\u691c\u7d22\";\n$position = strpos($text, \"PHP\");\n\n\/\/ \u9593\u9055\u3063\u305f\u5224\u5b9a\u65b9\u6cd5\nif ($position) { \/\/ \u4f4d\u7f6e0\u306e\u5834\u5408false\u3068\u5224\u5b9a\u3055\u308c\u3066\u3057\u307e\u3046\n    echo \"\u898b\u3064\u304b\u308a\u307e\u3057\u305f\";\n}\n\n\/\/ \u6b63\u3057\u3044\u5224\u5b9a\u65b9\u6cd5\nif ($position !== false) { \/\/ \u53b3\u5bc6\u306a\u6bd4\u8f03\u3092\u4f7f\u7528\n    echo \"\u898b\u3064\u304b\u308a\u307e\u3057\u305f\";\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-14\">str_contains()\u95a2\u6570\u306e\u4f7f\u3044\u65b9\uff08PHP 8.0\u4ee5\u964d\uff09<\/h3>\n\n\n\n<p>PHP 8.0\u3067\u5c0e\u5165\u3055\u308c\u305f<code>str_contains()<\/code>\u95a2\u6570\u306f\u3001\u6587\u5b57\u5217\u304c\u4ed6\u306e\u6587\u5b57\u5217\u3092\u542b\u3080\u304b\u3069\u3046\u304b\u3092\u30b7\u30f3\u30d7\u30eb\u306b\u5224\u5b9a\u3067\u304d\u308b\u95a2\u6570\u3067\u3059\u3002\u5185\u90e8\u7684\u306b\u306f<code>strpos()<\/code>\u3068\u540c\u69d8\u306e\u51e6\u7406\u3092\u884c\u3044\u307e\u3059\u304c\u3001boolean\u5024\u3092\u8fd4\u3059\u305f\u3081\u3001\u3088\u308a\u76f4\u611f\u7684\u306b\u4f7f\u7528\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=\"\">\/\/ str_contains(\u691c\u7d22\u5bfe\u8c61\u6587\u5b57\u5217, \u63a2\u3059\u6587\u5b57\u5217): bool\n$text = \"PHP\u3067\u6587\u5b57\u5217\u691c\u7d22\u3092\u5b66\u3076\";\n\n\/\/ PHP 8.0\u4ee5\u964d\nif (str_contains($text, \"\u6587\u5b57\u5217\")) {\n    echo \"\u6587\u5b57\u5217\u3092\u542b\u3093\u3067\u3044\u307e\u3059\"; \/\/ \u3053\u306e\u30d6\u30ed\u30c3\u30af\u304c\u5b9f\u884c\u3055\u308c\u308b\n}\n\n\/\/ PHP 7.x\u3067\u306e\u540c\u7b49\u306e\u66f8\u304d\u65b9\nif (strpos($text, \"\u6587\u5b57\u5217\") !== false) {\n    echo \"\u6587\u5b57\u5217\u3092\u542b\u3093\u3067\u3044\u307e\u3059\";\n}\n<\/pre>\n\n\n\n<p><code>str_contains()<\/code>\u306e\u4e3b\u306a\u30e1\u30ea\u30c3\u30c8\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30b3\u30fc\u30c9\u306e\u53ef\u8aad\u6027\u304c\u5411\u4e0a\u3059\u308b<\/li>\n\n\n\n<li>\u4f4d\u7f6e0\u3067\u306e\u691c\u51fa\u30df\u30b9\u3092\u907f\u3051\u3089\u308c\u308b<\/li>\n\n\n\n<li>\u610f\u56f3\u304c\u660e\u78ba\u306b\u4f1d\u308f\u308b<\/li>\n\n\n\n<li>\u5185\u90e8\u7684\u306b\u6700\u9069\u5316\u3055\u308c\u3066\u3044\u308b<\/li>\n<\/ul>\n\n\n\n<p>PHP 8.0\u4ee5\u964d\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u306f\u3001\u5358\u7d14\u306a\u6587\u5b57\u5217\u306e\u542b\u6709\u30c1\u30a7\u30c3\u30af\u306b\u306f<code>str_contains()<\/code>\u3092\u4f7f\u7528\u3059\u308b\u306e\u304c\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-15\">strstr()\u3068stristr()\u306b\u3088\u308b\u6587\u5b57\u5217\u691c\u7d22\u3068\u53d6\u5f97<\/h3>\n\n\n\n<p><code>strstr()<\/code>\u3068<code>stristr()<\/code>\u306f\u3001\u691c\u7d22\u3068\u540c\u6642\u306b\u90e8\u5206\u6587\u5b57\u5217\u306e\u53d6\u5f97\u304c\u53ef\u80fd\u306a\u95a2\u6570\u3067\u3059\u3002\u898b\u3064\u304b\u3063\u305f\u6587\u5b57\u5217\u3092\u542b\u3080\u3001\u305d\u308c\u4ee5\u964d\u306e\u5168\u3066\u306e\u6587\u5b57\u5217\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-16\">strstr() \u2013 \u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3059\u308b\u691c\u7d22\u3068\u53d6\u5f97<\/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=\"\">\/\/ strstr(\u691c\u7d22\u5bfe\u8c61\u6587\u5b57\u5217, \u63a2\u3059\u6587\u5b57\u5217, [\u898b\u3064\u304b\u308b\u524d\u306e\u6587\u5b57\u5217\u3092\u8fd4\u3059\u304b])\n$email = \"info@example.com\";\n\n\/\/ @\u4ee5\u964d\u3092\u53d6\u5f97\n$domain = strstr($email, \"@\"); \necho $domain; \/\/ \u51fa\u529b: @example.com\n\n\/\/ @\u3088\u308a\u524d\u3092\u53d6\u5f97\uff08\u7b2c3\u5f15\u6570\u306btrue\u3092\u6307\u5b9a\uff09\n$username = strstr($email, \"@\", true);\necho $username; \/\/ \u51fa\u529b: info\n\n\/\/ \u691c\u7d22\u6587\u5b57\u5217\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u5834\u5408\u306ffalse\u3092\u8fd4\u3059\n$result = strstr($email, \"xyz\");\nvar_dump($result); \/\/ \u51fa\u529b: bool(false)\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-17\">stristr() \u2013 \u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22\u3068\u53d6\u5f97<\/h4>\n\n\n\n<p><code>stristr()<\/code>\u306f<code>strstr()<\/code>\u3068\u540c\u3058\u6a5f\u80fd\u3067\u3059\u304c\u3001\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u305b\u305a\u306b\u691c\u7d22\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=\"\">\/\/ stristr(\u691c\u7d22\u5bfe\u8c61\u6587\u5b57\u5217, \u63a2\u3059\u6587\u5b57\u5217, [\u898b\u3064\u304b\u308b\u524d\u306e\u6587\u5b57\u5217\u3092\u8fd4\u3059\u304b])\n$text = \"PHP\u958b\u767a\u3067\u6587\u5b57\u5217\u691c\u7d22\u3092\u52b9\u7387\u5316\u3059\u308b\";\n\n\/\/ \u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u305b\u305a\u306b\u300cphp\u300d\u3092\u691c\u7d22\n$result = stristr($text, \"php\");\necho $result; \/\/ \u51fa\u529b: PHP\u958b\u767a\u3067\u6587\u5b57\u5217\u691c\u7d22\u3092\u52b9\u7387\u5316\u3059\u308b\n\n\/\/ \u300c\u958b\u767a\u300d\u3088\u308a\u524d\u306e\u90e8\u5206\u3092\u53d6\u5f97\n$first_part = stristr($text, \"\u958b\u767a\", true);\necho $first_part; \/\/ \u51fa\u529b: PHP\n<\/pre>\n\n\n\n<p><code>strstr()<\/code>\u3068<code>stristr()<\/code>\u306e\u4e3b\u306a\u7528\u9014\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u304b\u3089\u30c9\u30e1\u30a4\u30f3\u90e8\u5206\u307e\u305f\u306f\u30e6\u30fc\u30b6\u30fc\u540d\u90e8\u5206\u3092\u62bd\u51fa<\/li>\n\n\n\n<li>URL\u304b\u3089\u30d7\u30ed\u30c8\u30b3\u30eb\u90e8\u5206\u3084\u7279\u5b9a\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u62bd\u51fa<\/li>\n\n\n\n<li>\u7279\u5b9a\u306e\u30de\u30fc\u30ab\u30fc\u4ee5\u964d\u306e\u30c6\u30ad\u30b9\u30c8\u3092\u53d6\u5f97<\/li>\n\n\n\n<li>\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u7279\u5b9a\u30a4\u30d9\u30f3\u30c8\u4ee5\u964d\u306e\u30a8\u30f3\u30c8\u30ea\u3092\u62bd\u51fa<\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-18\">\u5404\u95a2\u6570\u306e\u4f7f\u3044\u5206\u3051<\/h4>\n\n\n\n<p>PHP\u306e\u57fa\u672c\u7684\u306a\u6587\u5b57\u5217\u691c\u7d22\u95a2\u6570\u306f\u3001\u305d\u308c\u305e\u308c\u7279\u5fb4\u304c\u3042\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u8868\u306f\u3001\u7528\u9014\u306b\u5fdc\u3058\u305f\u95a2\u6570\u9078\u629e\u306e\u53c2\u8003\u306b\u306a\u308a\u307e\u3059\uff1a<\/p>\n\n\n<div id=\"id-6e7290d0-240d-4c01-8db9-8b21c9cbfd71\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u76ee\u7684<\/th><th>\u6700\u9069\u306a\u95a2\u6570<\/th><th>\u7406\u7531<\/th><\/tr><\/thead><tbody><tr><td>\u6587\u5b57\u5217\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u304b\u5224\u5b9a<\/td><td>str_contains() (PHP 8.0+)<\/td><td>\u76f4\u611f\u7684\u3067\u308f\u304b\u308a\u3084\u3059\u3044<\/td><\/tr><tr><td>\u6587\u5b57\u5217\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u304b\u5224\u5b9a\uff08PHP 7.x\u4ee5\u524d\uff09<\/td><td>strpos()<\/td><td>\u9ad8\u901f\u3067\u52b9\u7387\u7684<\/td><\/tr><tr><td>\u6587\u5b57\u5217\u304c\u6700\u5f8c\u306b\u51fa\u73fe\u3059\u308b\u4f4d\u7f6e\u3092\u691c\u7d22<\/td><td>strrpos()<\/td><td>\u5f8c\u65b9\u304b\u3089\u306e\u691c\u7d22\u306b\u7279\u5316<\/td><\/tr><tr><td>\u691c\u7d22\u3068\u540c\u6642\u306b\u90e8\u5206\u6587\u5b57\u5217\u53d6\u5f97<\/td><td>strstr()<\/td><td>\u4f59\u5206\u306a\u51e6\u7406\u304c\u4e0d\u8981<\/td><\/tr><tr><td>\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u305b\u305a\u691c\u7d22\u3068\u53d6\u5f97<\/td><td>stristr()<\/td><td>\u67d4\u8edf\u306a\u691c\u7d22\u304c\u53ef\u80fd<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<p>\u6587\u5b57\u5217\u691c\u7d22\u306e\u57fa\u672c\u95a2\u6570\u3092\u7406\u89e3\u3059\u308b\u3053\u3068\u3067\u3001\u8907\u96d1\u306a\u6587\u5b57\u5217\u51e6\u7406\u3082\u52b9\u7387\u7684\u306b\u5b9f\u88c5\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22\u30c6\u30af\u30cb\u30c3\u30af\u306b\u3064\u3044\u3066\u3055\u3089\u306b\u8a73\u3057\u304f\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-19\">\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22\u30c6\u30af\u30cb\u30c3\u30af<\/h2>\n\n\n\n<p>\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u306e\u691c\u8a3c\u3084\u30c7\u30fc\u30bf\u691c\u7d22\u306a\u3069\u3001\u591a\u304f\u306e\u5834\u9762\u3067\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u305b\u305a\u306b\u6587\u5b57\u5217\u691c\u7d22\u3092\u884c\u3044\u305f\u3044\u30b1\u30fc\u30b9\u304c\u3042\u308a\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u300cPHP\u300d\u3092\u691c\u7d22\u3057\u305f\u3068\u304d\u3001\u300cphp\u300d\u3084\u300cPhp\u300d\u306a\u3069\u3082\u691c\u7d22\u7d50\u679c\u306b\u542b\u3081\u305f\u3044\u5834\u5408\u3067\u3059\u3002PHP\u306b\u306f\u3001\u3053\u306e\u3088\u3046\u306a\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\uff08case-insensitive\uff09\u691c\u7d22\u3092\u5b9f\u73fe\u3059\u308b\u305f\u3081\u306e\u8907\u6570\u306e\u65b9\u6cd5\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-20\">strtolower()\u3068strtoupper()\u3092\u7d44\u307f\u5408\u308f\u305b\u305f\u691c\u7d22\u65b9\u6cd5<\/h3>\n\n\n\n<p>\u6700\u3082\u57fa\u672c\u7684\u306a\u30a2\u30d7\u30ed\u30fc\u30c1\u306f\u3001\u691c\u7d22\u5bfe\u8c61\u3068\u691c\u7d22\u30d1\u30bf\u30fc\u30f3\u306e\u4e21\u65b9\u3092\u540c\u3058\u30b1\u30fc\u30b9\uff08\u5927\u6587\u5b57\u307e\u305f\u306f\u5c0f\u6587\u5b57\uff09\u306b\u5909\u63db\u3057\u3066\u304b\u3089\u6bd4\u8f03\u3059\u308b\u65b9\u6cd5\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=\"\">\/\/ strtolower()\u3092\u4f7f\u7528\u3057\u305f\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22\n$haystack = \"PHP\u958b\u767a\u8005\u306e\u305f\u3081\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\";\n$needle = \"php\";\n\n\/\/ \u4e21\u65b9\u3092\u5c0f\u6587\u5b57\u306b\u5909\u63db\u3057\u3066\u6bd4\u8f03\nif (strpos(strtolower($haystack), strtolower($needle)) !== false) {\n    echo \"\u6587\u5b57\u5217\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\"; \/\/ \u3053\u306e\u30d6\u30ed\u30c3\u30af\u304c\u5b9f\u884c\u3055\u308c\u308b\n}\n\n\/\/ \u540c\u69d8\u306b\u5927\u6587\u5b57\u306b\u5909\u63db\u3059\u308b\u65b9\u6cd5\u3082\u53ef\u80fd\nif (strpos(strtoupper($haystack), strtoupper($needle)) !== false) {\n    echo \"\u6587\u5b57\u5217\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\"; \/\/ \u3053\u306e\u30d6\u30ed\u30c3\u30af\u304c\u5b9f\u884c\u3055\u308c\u308b\n}\n<\/pre>\n\n\n\n<p><strong>\u30e1\u30ea\u30c3\u30c8<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30b7\u30f3\u30d7\u30eb\u3067\u7406\u89e3\u3057\u3084\u3059\u3044<\/li>\n\n\n\n<li>\u3059\u3079\u3066\u306ePHP\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u52d5\u4f5c\u3059\u308b<\/li>\n\n\n\n<li>\u4ed6\u306e\u51e6\u7406\u3068\u7d44\u307f\u5408\u308f\u305b\u3084\u3059\u3044<\/li>\n<\/ul>\n\n\n\n<p><strong>\u30c7\u30e1\u30ea\u30c3\u30c8<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u8ffd\u52a0\u306e\u95a2\u6570\u547c\u3073\u51fa\u3057\u304c\u5fc5\u8981\u3067\u3084\u3084\u5197\u9577<\/li>\n\n\n\n<li>\u5927\u91cf\u306e\u6587\u5b57\u5217\u51e6\u7406\u3067\u306f\u975e\u52b9\u7387\u306b\u306a\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b<\/li>\n\n\n\n<li>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\uff08\u65e5\u672c\u8a9e\u306a\u3069\uff09\u306b\u306f\u9069\u3057\u3066\u3044\u306a\u3044<\/li>\n<\/ul>\n\n\n\n<p>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u6271\u3046\u5834\u5408\u306f\u3001<code>mb_strtolower()<\/code>\u3068<code>mb_strtoupper()<\/code>\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\u5bfe\u5fdc\u7248\n$text = \"PHP\u6587\u5b57\u5217\u691c\u7d22\u306e\u4f8b\";\n$search = \"php\u6587\u5b57\u5217\";\n\nif (mb_strpos(mb_strtolower($text), mb_strtolower($search)) !== false) {\n    echo \"\u898b\u3064\u304b\u308a\u307e\u3057\u305f\";\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-21\">stripos()\u3068strripos()\u306e\u6d3b\u7528\u6cd5<\/h3>\n\n\n\n<p>PHP\u306b\u306f\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u305b\u305a\u306b\u691c\u7d22\u3059\u308b\u305f\u3081\u306e\u5c02\u7528\u95a2\u6570<code>stripos()<\/code>\uff08\u524d\u65b9\u691c\u7d22\uff09\u3068<code>strripos()<\/code>\uff08\u5f8c\u65b9\u691c\u7d22\uff09\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u3089\u306f<code>strpos()<\/code>\u3068<code>strrpos()<\/code>\u306e\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\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=\"\">\/\/ stripos(\u691c\u7d22\u5bfe\u8c61\u6587\u5b57\u5217, \u63a2\u3059\u6587\u5b57\u5217, [\u958b\u59cb\u4f4d\u7f6e])\n$text = \"PHP\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3067php\u95a2\u6570\u3092\u5b66\u3076\";\n$search = \"php\";\n\n\/\/ \u6700\u521d\u306b\u51fa\u73fe\u3059\u308b\u4f4d\u7f6e\u3092\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u533a\u5225\u306a\u3057\u3067\u691c\u7d22\n$position = stripos($text, $search);\necho $position; \/\/ \u51fa\u529b: 0\uff08\u300cPHP\u300d\u304c\u5148\u982d\u306b\u3042\u308b\u305f\u3081\uff09\n\n\/\/ 2\u756a\u76ee\u306e\u51fa\u73fe\u4f4d\u7f6e\u3092\u691c\u7d22\n$position = stripos($text, $search, $position + 1);\necho $position; \/\/ \u51fa\u529b: 9\uff08\u300cphp\u300d\u306e\u4f4d\u7f6e\uff09\n\n\/\/ \u6700\u5f8c\u306b\u51fa\u73fe\u3059\u308b\u4f4d\u7f6e\u3092\u5f8c\u65b9\u304b\u3089\u691c\u7d22\n$last_position = strripos($text, $search);\necho $last_position; \/\/ \u51fa\u529b: 9\n<\/pre>\n\n\n\n<p><code>stripos()<\/code>\u3068<code>strripos()<\/code>\u306e\u30e1\u30ea\u30c3\u30c8\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30b3\u30fc\u30c9\u304c\u30af\u30ea\u30fc\u30f3\u306b\u306a\u308b\uff08\u5909\u63db\u95a2\u6570\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u5fc5\u8981\u304c\u306a\u3044\uff09<\/li>\n\n\n\n<li>\u4e00\u822c\u7684\u306b<code>strtolower()<\/code>\u3092\u4f7f\u7528\u3059\u308b\u65b9\u6cd5\u3088\u308a\u3082\u9ad8\u901f<\/li>\n\n\n\n<li>\u30b7\u30f3\u30d7\u30eb\u3067\u4f7f\u3044\u3084\u3059\u3044<\/li>\n<\/ul>\n\n\n\n<p>\u6ce8\u610f\u70b9\u3068\u3057\u3066\u3001<code>stripos()<\/code>\u3082<code>strpos()<\/code>\u3068\u540c\u69d8\u306b\u3001\u898b\u3064\u304b\u3089\u306a\u3044\u5834\u5408\u306f<code>false<\/code>\u3092\u8fd4\u3057\u3001\u5148\u982d\uff08\u4f4d\u7f6e0\uff09\u3067\u898b\u3064\u304b\u3063\u305f\u5834\u5408\u306f<code>0<\/code>\u3092\u8fd4\u3059\u305f\u3081\u3001\u5fc5\u305a<code>!== false<\/code>\u3067\u6bd4\u8f03\u3059\u308b\u5fc5\u8981\u304c\u3042\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=\"\">\/\/ \u6b63\u3057\u3044\u6bd4\u8f03\u65b9\u6cd5\n$text = \"PHP\u8a00\u8a9e\";\n$result = stripos($text, \"python\");\nif ($result !== false) {\n    echo \"\u898b\u3064\u304b\u308a\u307e\u3057\u305f\";\n} else {\n    echo \"\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\"; \/\/ \u3053\u306e\u30d6\u30ed\u30c3\u30af\u304c\u5b9f\u884c\u3055\u308c\u308b\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-22\">mb_stripos()\u306b\u3088\u308b\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u306e\u691c\u7d22<\/h3>\n\n\n\n<p>\u65e5\u672c\u8a9e\u3084\u4e2d\u56fd\u8a9e\u3001\u30a2\u30e9\u30d3\u30a2\u8a9e\u306a\u3069\u306e\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u542b\u3080\u6587\u5b57\u5217\u3092\u6271\u3046\u5834\u5408\u306f\u3001<code>mb_stripos()<\/code>\u95a2\u6570\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u3053\u308c\u306f<code>stripos()<\/code>\u306e\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u5bfe\u5fdc\u7248\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=\"\">\/\/ mb_stripos(\u691c\u7d22\u5bfe\u8c61\u6587\u5b57\u5217, \u63a2\u3059\u6587\u5b57\u5217, [\u958b\u59cb\u4f4d\u7f6e], [\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0])\n$text = \"PHP\uff08\u30d4\u30fc\u30a8\u30a4\u30c1\u30d4\u30fc\uff09\u306f\u4eba\u6c17\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3067\u3059\";\n$search = \"\uff50\uff48\uff50\"; \/\/ \u5168\u89d2\u6587\u5b57\n\n\/\/ \u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u5bfe\u5fdc\u306e\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22\n$position = mb_stripos($text, $search);\nif ($position !== false) {\n    echo \"\u4f4d\u7f6e: \" . $position; \/\/ \u901a\u5e38\u306f\u898b\u3064\u304b\u3089\u306a\u3044\u304c\u3001\u74b0\u5883\u306b\u3088\u3063\u3066\u306f\u898b\u3064\u304b\u308b\u5834\u5408\u3082\u3042\u308b\n} else {\n    echo \"\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\";\n}\n\n\/\/ \u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u660e\u793a\u7684\u306b\u6307\u5b9a\n$position = mb_stripos($text, \"php\", 0, \"UTF-8\");\nif ($position !== false) {\n    echo \"\u4f4d\u7f6e: \" . $position; \/\/ \u51fa\u529b: \u4f4d\u7f6e: 0\n} else {\n    echo \"\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\";\n}\n<\/pre>\n\n\n\n<p><code>mb_stripos()<\/code>\u3092\u4f7f\u7528\u3059\u308b\u969b\u306e\u6ce8\u610f\u70b9\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u306e\u6307\u5b9a<\/strong>: \u660e\u793a\u7684\u306b\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001\u4e88\u671f\u3057\u306a\u3044\u52d5\u4f5c\u3092\u907f\u3051\u3089\u308c\u307e\u3059<\/li>\n\n\n\n<li><strong>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9<\/strong>: \u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u95a2\u6570\u306f\u901a\u5e38\u306e\u95a2\u6570\u3088\u308a\u51e6\u7406\u304c\u9045\u304f\u306a\u308b\u305f\u3081\u3001ASCII\u306e\u307f\u306e\u6587\u5b57\u5217\u3067\u306f\u901a\u5e38\u7248\u3092\u4f7f\u7528\u3057\u305f\u65b9\u304c\u52b9\u7387\u7684\u3067\u3059<\/li>\n\n\n\n<li><strong>\u6587\u5b57\u4f4d\u7f6e<\/strong>: \u8fd4\u3055\u308c\u308b\u4f4d\u7f6e\u306f\u6587\u5b57\u6570\uff08\u6587\u5b57\u5358\u4f4d\uff09\u3067\u3042\u308a\u3001\u30d0\u30a4\u30c8\u6570\u3067\u306f\u3042\u308a\u307e\u305b\u3093<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-23\">\u30b1\u30fc\u30b9\u30bb\u30f3\u30b7\u30c6\u30a3\u30d6\u691c\u7d22\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6bd4\u8f03<\/h3>\n\n\n\n<p>\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22\u65b9\u6cd5\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u6bd4\u8f03\u3057\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=\"\">$haystack = str_repeat(\"PHP\u958b\u767a\u8005\u306e\u305f\u3081\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\", 1000);\n$needle = \"php\";\n\n\/\/ \u65b9\u6cd51: strtolower()\u3092\u4f7f\u7528\n$start = microtime(true);\n$result = strpos(strtolower($haystack), strtolower($needle));\necho \"strtolower + strpos: \" . (microtime(true) - $start) . \"\u79d2\\n\";\n\n\/\/ \u65b9\u6cd52: stripos()\u3092\u4f7f\u7528\n$start = microtime(true);\n$result = stripos($haystack, $needle);\necho \"stripos: \" . (microtime(true) - $start) . \"\u79d2\\n\";\n\n\/\/ \u65b9\u6cd53: mb_strtolower()\u3092\u4f7f\u7528\n$start = microtime(true);\n$result = mb_strpos(mb_strtolower($haystack), mb_strtolower($needle));\necho \"mb_strtolower + mb_strpos: \" . (microtime(true) - $start) . \"\u79d2\\n\";\n\n\/\/ \u65b9\u6cd54: mb_stripos()\u3092\u4f7f\u7528\n$start = microtime(true);\n$result = mb_stripos($haystack, $needle);\necho \"mb_stripos: \" . (microtime(true) - $start) . \"\u79d2\\n\";\n<\/pre>\n\n\n\n<p>\u4e00\u822c\u7684\u306a\u50be\u5411\u3068\u3057\u3066\u3001\u4ee5\u4e0b\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u9806\u5e8f\u304c\u898b\u3089\u308c\u307e\u3059\uff08\u901f\u3044\u9806\uff09\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>stripos() \u2013 \u6700\u3082\u9ad8\u901f<\/li>\n\n\n\n<li>strpos() + strtolower() \u2013 \u3084\u3084\u9045\u3044<\/li>\n\n\n\n<li>mb_stripos() \u2013 \u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u5bfe\u5fdc\u306e\u305f\u3081\u9045\u3044<\/li>\n\n\n\n<li>mb_strpos() + mb_strtolower() \u2013 \u6700\u3082\u9045\u3044<\/li>\n<\/ol>\n\n\n\n<p>\u5b9f\u969b\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u306f\u3001\u6271\u3046\u6587\u5b57\u5217\u306e\u7a2e\u985e\u306b\u5fdc\u3058\u3066\u9069\u5207\u306a\u65b9\u6cd5\u3092\u9078\u629e\u3059\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>ASCII\u6587\u5b57\u306e\u307f\u3092\u6271\u3046\u5834\u5408: <code>stripos()<\/code><\/li>\n\n\n\n<li>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u6271\u3046\u5834\u5408: <code>mb_stripos()<\/code><\/li>\n\n\n\n<li>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u7279\u306b\u91cd\u8981\u306a\u5834\u5408: \u4e8b\u524d\u306b\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u6b63\u898f\u5316\u3057\u3066\u304b\u3089\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f5c\u6210<\/li>\n<\/ul>\n\n\n\n<p>\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u8907\u6570\u306e\u6587\u5b57\u5217\u30d1\u30bf\u30fc\u30f3\u3092\u4e00\u5ea6\u306b\u691c\u7d22\u3059\u308b\u52b9\u7387\u7684\u306a\u65b9\u6cd5\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-24\">\u8907\u6570\u306e\u6587\u5b57\u5217\u30d1\u30bf\u30fc\u30f3\u3092\u4e00\u5ea6\u306b\u691c\u7d22\u3059\u308b\u65b9\u6cd5<\/h2>\n\n\n\n<p>\u5b9f\u52d9\u3067\u306f\u3001\u4e00\u3064\u306e\u6587\u5b57\u5217\u5185\u3067\u8907\u6570\u306e\u30d1\u30bf\u30fc\u30f3\u3092\u540c\u6642\u306b\u691c\u7d22\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u5834\u9762\u304c\u3088\u304f\u3042\u308a\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u7981\u6b62\u8a9e\u53e5\u306e\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u3001\u8907\u6570\u306e\u30ad\u30fc\u30ef\u30fc\u30c9\u306e\u5b58\u5728\u78ba\u8a8d\u3001\u7279\u5b9a\u306e\u30bf\u30b0\u306e\u62bd\u51fa\u306a\u3069\u3067\u3059\u3002PHP\u3067\u306f\u8907\u6570\u306e\u6587\u5b57\u5217\u30d1\u30bf\u30fc\u30f3\u3092\u52b9\u7387\u7684\u306b\u691c\u7d22\u3059\u308b\u305f\u3081\u306e\u69d8\u3005\u306a\u30c6\u30af\u30cb\u30c3\u30af\u304c\u5229\u7528\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-25\">strpbrk()\u3092\u4f7f\u3063\u305f\u8907\u6570\u6587\u5b57\u691c\u7d22<\/h3>\n\n\n\n<p><code>strpbrk()<\/code>\u95a2\u6570\u306f\u3001\u6587\u5b57\u5217\u5185\u3067\u6307\u5b9a\u3055\u308c\u305f\u8907\u6570\u306e\u6587\u5b57\u306e\u3046\u3061\u3001\u3044\u305a\u308c\u304b1\u3064\u304c\u6700\u521d\u306b\u73fe\u308c\u308b\u4f4d\u7f6e\u304b\u3089\u672b\u5c3e\u307e\u3067\u306e\u90e8\u5206\u6587\u5b57\u5217\u3092\u8fd4\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=\"\">\/\/ strpbrk(\u691c\u7d22\u5bfe\u8c61\u6587\u5b57\u5217, \u691c\u7d22\u3059\u308b\u6587\u5b57\u306e\u96c6\u5408)\n$text = \"PHP: Hypertext Preprocessor\";\n$characters = \"xy:HP\";\n\n\/\/ \u6307\u5b9a\u3055\u308c\u305f\u6587\u5b57\u306e\u3044\u305a\u308c\u304b\u304c\u6700\u521d\u306b\u73fe\u308c\u308b\u4f4d\u7f6e\u304b\u3089\u5f8c\u308d\u3092\u53d6\u5f97\n$result = strpbrk($text, $characters);\necho $result; \/\/ \u51fa\u529b: \"PHP: Hypertext Preprocessor\"\uff08'P'\u304c\u6700\u521d\u306b\u898b\u3064\u304b\u3063\u305f\uff09\n\n\/\/ \u5225\u306e\u4f8b\n$result = strpbrk(\"hello@example.com\", \"@.\");\necho $result; \/\/ \u51fa\u529b: \"@example.com\"\uff08'@'\u304c\u6700\u521d\u306b\u898b\u3064\u304b\u3063\u305f\uff09\n<\/pre>\n\n\n\n<p><strong><code>strpbrk()<\/code>\u306e\u4e3b\u306a\u7279\u5fb4<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u5358\u4e00\u306e\u6587\u5b57\u306e\u307f\u3092\u691c\u7d22\u5bfe\u8c61\u3068\u3059\u308b\uff08\u5358\u8a9e\u3084\u30d5\u30ec\u30fc\u30ba\u306f\u691c\u7d22\u3067\u304d\u306a\u3044\uff09<\/li>\n\n\n\n<li>\u6307\u5b9a\u3055\u308c\u305f\u6587\u5b57\u30bb\u30c3\u30c8\u306e\u3046\u3061\u3001\u6700\u521d\u306b\u898b\u3064\u304b\u3063\u305f\u6587\u5b57\u304b\u3089\u672b\u5c3e\u307e\u3067\u3092\u8fd4\u3059<\/li>\n\n\n\n<li>\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u5834\u5408\u306f<code>false<\/code>\u3092\u8fd4\u3059<\/li>\n<\/ol>\n\n\n\n<p><strong>\u5b9f\u7528\u7684\u306a\u4f7f\u7528\u4f8b<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306e\u30c9\u30e1\u30a4\u30f3\u533a\u5207\u308a\uff08@\u4ee5\u964d\uff09\u3092\u53d6\u5f97<\/li>\n\n\n\n<li>\u6587\u5b57\u5217\u5185\u306e\u7279\u6b8a\u6587\u5b57\u3092\u691c\u51fa<\/li>\n\n\n\n<li>\u533a\u5207\u308a\u6587\u5b57\u306e\u4f4d\u7f6e\u3092\u7279\u5b9a<\/li>\n<\/ul>\n\n\n\n<p><code>strpbrk()<\/code>\u306f\u5358\u4e00\u6587\u5b57\u306e\u8907\u6570\u30d1\u30bf\u30fc\u30f3\u691c\u7d22\u306b\u9650\u5b9a\u3055\u308c\u308b\u305f\u3081\u3001\u8907\u6570\u306e\u5358\u8a9e\u3084\u30d5\u30ec\u30fc\u30ba\u3092\u691c\u7d22\u3059\u308b\u5834\u5408\u306f\u5225\u306e\u30a2\u30d7\u30ed\u30fc\u30c1\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-26\">str_replace()\u3068array_intersect()\u3092\u7d44\u307f\u5408\u308f\u305b\u305f\u30c6\u30af\u30cb\u30c3\u30af<\/h3>\n\n\n\n<p>\u8907\u6570\u306e\u5358\u8a9e\u3084\u30d5\u30ec\u30fc\u30ba\u3092\u691c\u7d22\u3059\u308b\u52b9\u679c\u7684\u306a\u65b9\u6cd5\u306e\u4e00\u3064\u306f\u3001<code>str_replace()<\/code>\u3068<code>array_intersect()<\/code>\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u65b9\u6cd5\u3067\u3059\u3002\u3053\u306e\u65b9\u6cd5\u3067\u306f\u3001\u691c\u7d22\u30d1\u30bf\u30fc\u30f3\u3092\u4e00\u6642\u7684\u306b\u30de\u30fc\u30ab\u30fc\u306b\u7f6e\u304d\u63db\u3048\u3001\u305d\u306e\u5f8c\u306b\u691c\u51fa\u3059\u308b\u6280\u8853\u3092\u7528\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=\"\">\/\/ \u8907\u6570\u30ad\u30fc\u30ef\u30fc\u30c9\u306e\u5b58\u5728\u30c1\u30a7\u30c3\u30af\nfunction check_keywords($text, $keywords) {\n    \/\/ \u4e00\u6642\u30de\u30fc\u30ab\u30fc\u3068\u5143\u306e\u30ad\u30fc\u30ef\u30fc\u30c9\u306e\u30de\u30c3\u30d4\u30f3\u30b0\n    $markers = [];\n    $replacements = [];\n    \n    \/\/ \u5404\u30ad\u30fc\u30ef\u30fc\u30c9\u306b\u30e6\u30cb\u30fc\u30af\u306a\u30de\u30fc\u30ab\u30fc\u3092\u5272\u308a\u5f53\u3066\n    foreach ($keywords as $index =&gt; $keyword) {\n        $marker = \"##MARKER{$index}##\";\n        $markers[$marker] = $keyword;\n        $replacements[] = $marker;\n    }\n    \n    \/\/ \u3059\u3079\u3066\u306e\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u30de\u30fc\u30ab\u30fc\u306b\u7f6e\u63db\n    $modified_text = str_replace($keywords, $replacements, $text, $count);\n    \n    \/\/ \u691c\u51fa\u3055\u308c\u305f\u30ad\u30fc\u30ef\u30fc\u30c9\n    $found_keywords = [];\n    \n    \/\/ \u30de\u30fc\u30ab\u30fc\u3092\u691c\u7d22\n    foreach ($markers as $marker =&gt; $original) {\n        if (strpos($modified_text, $marker) !== false) {\n            $found_keywords[] = $original;\n        }\n    }\n    \n    return [\n        'found' =&gt; count($found_keywords) &gt; 0,\n        'keywords' =&gt; $found_keywords,\n        'count' =&gt; $count\n    ];\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$text = \"PHP\u306fWeb\u958b\u767a\u306b\u304a\u3051\u308b\u4eba\u6c17\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3067\u3059\u3002PHP\u3067\u6587\u5b57\u5217\u64cd\u4f5c\u3082\u7c21\u5358\u3067\u3059\u3002\";\n$keywords = [\"PHP\", \"Web\u958b\u767a\", \"Java\", \"Python\"];\n\n$result = check_keywords($text, $keywords);\nprint_r($result);\n\/\/ \u51fa\u529b:\n\/\/ Array (\n\/\/     [found] =&gt; 1\n\/\/     [keywords] =&gt; Array (\n\/\/         [0] =&gt; PHP\n\/\/         [1] =&gt; Web\u958b\u767a\n\/\/     )\n\/\/     [count] =&gt; 3\n\/\/ )\n<\/pre>\n\n\n\n<p>\u3053\u306e\u30c6\u30af\u30cb\u30c3\u30af\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5834\u9762\u3067\u7279\u306b\u6709\u7528\u3067\u3059\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u8907\u6570\u306e\u30ad\u30fc\u30ef\u30fc\u30c9\u306e\u6709\u7121\u3092\u4e00\u5ea6\u306b\u78ba\u8a8d\u3057\u305f\u3044\u5834\u5408<\/li>\n\n\n\n<li>\u30c6\u30ad\u30b9\u30c8\u5185\u306e\u7279\u5b9a\u5358\u8a9e\u306e\u51fa\u73fe\u56de\u6570\u3092\u30ab\u30a6\u30f3\u30c8\u3057\u305f\u3044\u5834\u5408<\/li>\n\n\n\n<li>\u7981\u6b62\u8a9e\u53e5\u306e\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0<\/li>\n<\/ul>\n\n\n\n<p>\u3088\u308a\u8907\u96d1\u306a\u30b1\u30fc\u30b9\u3067\u306f\u3001\u914d\u5217\u64cd\u4f5c\u95a2\u6570\u3068\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3055\u3089\u306b\u9ad8\u5ea6\u306a\u691c\u7d22\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-27\">\u914d\u5217\u5185\u306e\u6587\u5b57\u5217\u306b\u5bfe\u3059\u308b\u691c\u7d22\u65b9\u6cd5<\/h3>\n\n\n\n<p>\u30c6\u30ad\u30b9\u30c8\u3092\u5358\u8a9e\u3084\u884c\u306b\u5206\u5272\u3057\u3066\u304b\u3089\u691c\u7d22\u3092\u884c\u3046\u30a2\u30d7\u30ed\u30fc\u30c1\u3082\u52b9\u679c\u7684\u3067\u3059\u3002\u7279\u306b\u3001\u8907\u6570\u306e\u30d1\u30bf\u30fc\u30f3\u3068\u7167\u5408\u3057\u305f\u308a\u3001\u7279\u5b9a\u306e\u6761\u4ef6\u306b\u4e00\u81f4\u3059\u308b\u8981\u7d20\u3092\u62bd\u51fa\u3057\u305f\u308a\u3059\u308b\u5834\u5408\u306b\u4fbf\u5229\u3067\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-28\">array_filter()\u3092\u4f7f\u3063\u305f\u691c\u7d22<\/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=\"\">\/\/ \u914d\u5217\u5185\u3067\u7279\u5b9a\u306e\u30d1\u30bf\u30fc\u30f3\u3092\u542b\u3080\u8981\u7d20\u3092\u62bd\u51fa\nfunction find_matching_strings($strings, $patterns) {\n    return array_filter($strings, function($string) use ($patterns) {\n        foreach ($patterns as $pattern) {\n            if (strpos($string, $pattern) !== false) {\n                return true; \/\/ \u3044\u305a\u308c\u304b\u306e\u30d1\u30bf\u30fc\u30f3\u304c\u898b\u3064\u304b\u308c\u3070\u8981\u7d20\u3092\u4fdd\u6301\n            }\n        }\n        return false;\n    });\n}\n\n\/\/ \u4f7f\u7528\u4f8b\uff1a\u8907\u6570\u884c\u30c6\u30ad\u30b9\u30c8\u304b\u3089\u7279\u5b9a\u306e\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u542b\u3080\u884c\u3092\u62bd\u51fa\n$log_text = \"2023-01-01 INFO: \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u8d77\u52d5\\n2023-01-01 ERROR: \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u63a5\u7d9a\u5931\u6557\\n2023-01-01 INFO: \u518d\u8a66\u884c\\n2023-01-01 SUCCESS: \u63a5\u7d9a\u78ba\u7acb\";\n$lines = explode(\"\\n\", $log_text);\n$search_patterns = [\"ERROR\", \"FATAL\"];\n\n$error_lines = find_matching_strings($lines, $search_patterns);\nprint_r($error_lines);\n\/\/ \u51fa\u529b:\n\/\/ Array (\n\/\/     [1] =&gt; 2023-01-01 ERROR: \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u63a5\u7d9a\u5931\u6557\n\/\/ )\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-29\">\u914d\u5217\u5185\u306e\u3059\u3079\u3066\u306e\u8981\u7d20\u306b\u4e00\u81f4\u3059\u308b\u30d1\u30bf\u30fc\u30f3\u3092\u691c\u7d22<\/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=\"\">\/\/ \u3059\u3079\u3066\u306e\u30c6\u30ad\u30b9\u30c8\u306b\u5171\u901a\u3057\u3066\u542b\u307e\u308c\u308b\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u691c\u51fa\nfunction find_common_patterns($texts, $patterns) {\n    $results = [];\n    \n    foreach ($patterns as $pattern) {\n        $all_match = true;\n        \n        foreach ($texts as $text) {\n            if (stripos($text, $pattern) === false) {\n                $all_match = false;\n                break;\n            }\n        }\n        \n        if ($all_match) {\n            $results[] = $pattern;\n        }\n    }\n    \n    return $results;\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$product_descriptions = [\n    \"\u9ad8\u6027\u80fd\u306aPHP\u30b5\u30fc\u30d0\u30fc\u306f\u51e6\u7406\u901f\u5ea6\u304c\u901f\u304f\u4fe1\u983c\u6027\u3082\u9ad8\u3044\",\n    \"PHP\u958b\u767a\u74b0\u5883\u306e\u69cb\u7bc9\u304c\u5bb9\u6613\u3067\u3001\u521d\u5fc3\u8005\u306b\u3082\u6271\u3044\u3084\u3059\u3044\",\n    \"PHP\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u4f7f\u7528\u3057\u3066\u9ad8\u901f\u958b\u767a\u304c\u53ef\u80fd\"\n];\n\n$possible_keywords = [\"PHP\", \"\u958b\u767a\", \"\u30b5\u30fc\u30d0\u30fc\", \"\u9ad8\u901f\", \"\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\"];\n$common_keywords = find_common_patterns($product_descriptions, $possible_keywords);\n\nprint_r($common_keywords);\n\/\/ \u51fa\u529b:\n\/\/ Array (\n\/\/     [0] =&gt; PHP\n\/\/ )\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-30\">\u52b9\u7387\u7684\u306a\u8907\u6570\u30d1\u30bf\u30fc\u30f3\u691c\u7d22\u306e\u305f\u3081\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/h3>\n\n\n\n<p>\u8907\u6570\u30d1\u30bf\u30fc\u30f3\u306e\u691c\u7d22\u3092\u52b9\u7387\u7684\u306b\u884c\u3046\u305f\u3081\u306e\u3044\u304f\u3064\u304b\u306e\u30dd\u30a4\u30f3\u30c8\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u6b63\u898f\u8868\u73fe\u306e\u6d3b\u7528<\/strong>: \u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u30f3\u30b0\u306b\u306f<code>preg_match_all()<\/code>\u3092\u4f7f\u7528\uff08\u6b21\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u8a73\u8ff0\uff09<\/li>\n\n\n\n<li><strong>\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u4f5c\u6210<\/strong>: \u691c\u7d22\u304c\u983b\u7e41\u306b\u884c\u308f\u308c\u308b\u5834\u5408\u306f\u3001\u524d\u51e6\u7406\u3068\u3057\u3066\u30c6\u30ad\u30b9\u30c8\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f5c\u6210<\/li>\n\n\n\n<li><strong>\u30ad\u30e3\u30c3\u30b7\u30f3\u30b0<\/strong>: \u540c\u3058\u30d1\u30bf\u30fc\u30f3\u3067\u306e\u691c\u7d22\u7d50\u679c\u3092\u30ad\u30e3\u30c3\u30b7\u30e5<\/li>\n\n\n\n<li><strong>\u9069\u5207\u306a\u30c7\u30fc\u30bf\u69cb\u9020<\/strong>: \u30cf\u30c3\u30b7\u30e5\u30de\u30c3\u30d7\u3084\u30d7\u30ec\u30d5\u30a3\u30c3\u30af\u30b9\u6728\u306a\u3069\u306e\u52b9\u7387\u7684\u306a\u30c7\u30fc\u30bf\u69cb\u9020\u306e\u6d3b\u7528<\/li>\n\n\n\n<li><strong>\u5206\u5272\u51e6\u7406<\/strong>: \u5927\u91cf\u306e\u30c6\u30ad\u30b9\u30c8\u3092\u6271\u3046\u5834\u5408\u306f\u3001\u51e6\u7406\u3092\u5206\u5272\u3057\u3066\u884c\u3046<\/li>\n<\/ol>\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=\"\">\/\/ \u52b9\u7387\u7684\u306a\u8907\u6570\u30ad\u30fc\u30ef\u30fc\u30c9\u691c\u7d22\u306e\u4f8b\uff08\u30cf\u30c3\u30b7\u30e5\u30de\u30c3\u30d7\u6d3b\u7528\uff09\nfunction build_search_index($texts) {\n    $index = [];\n    \n    foreach ($texts as $id =&gt; $text) {\n        $words = str_word_count(strtolower($text), 1);\n        \n        foreach ($words as $word) {\n            if (!isset($index[$word])) {\n                $index[$word] = [];\n            }\n            $index[$word][] = $id;\n        }\n    }\n    \n    return $index;\n}\n\nfunction search_by_keywords($index, $keywords) {\n    if (empty($keywords)) {\n        return [];\n    }\n    \n    $keywords = array_map('strtolower', $keywords);\n    $result_sets = [];\n    \n    foreach ($keywords as $keyword) {\n        if (isset($index[$keyword])) {\n            $result_sets[] = $index[$keyword];\n        } else {\n            \/\/ \u30ad\u30fc\u30ef\u30fc\u30c9\u304c\u4e00\u3064\u3067\u3082\u898b\u3064\u304b\u3089\u306a\u3051\u308c\u3070\u7a7a\u7d50\u679c\n            return [];\n        }\n    }\n    \n    \/\/ \u3059\u3079\u3066\u306e\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u542b\u3080\u30c6\u30ad\u30b9\u30c8\u306eID\u3092\u53d6\u5f97\uff08\u914d\u5217\u306e\u4ea4\u5dee\uff09\n    return array_values(array_intersect(...$result_sets));\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$texts = [\n    1 =&gt; \"PHP\u306f\u4f7f\u3044\u3084\u3059\u3044\u30b9\u30af\u30ea\u30d7\u30c8\u8a00\u8a9e\u3067\u3059\",\n    2 =&gt; \"PHP\u3067Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\",\n    3 =&gt; \"Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u5165\u9580\",\n    4 =&gt; \"JavaScript\u3068PHP\u3092\u7d44\u307f\u5408\u308f\u305b\u305f\u958b\u767a\"\n];\n\n$index = build_search_index($texts);\n$results = search_by_keywords($index, [\"php\", \"\u958b\u767a\"]);\nprint_r($results);\n\/\/ \u51fa\u529b:\n\/\/ Array (\n\/\/     [0] =&gt; 2\n\/\/     [1] =&gt; 4\n\/\/ )\n<\/pre>\n\n\n\n<p>\u8907\u6570\u30d1\u30bf\u30fc\u30f3\u306e\u691c\u7d22\u306f\u3001\u30c6\u30ad\u30b9\u30c8\u5206\u6790\u3001\u30b3\u30f3\u30c6\u30f3\u30c4\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u3001\u691c\u7d22\u30a8\u30f3\u30b8\u30f3\u6a5f\u80fd\u306e\u5b9f\u88c5\u306a\u3069\u3001\u69d8\u3005\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u91cd\u8981\u306a\u5f79\u5272\u3092\u679c\u305f\u3057\u307e\u3059\u3002\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u3088\u308a\u9ad8\u5ea6\u306a\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u30f3\u30b0\u306e\u305f\u3081\u306e\u6b63\u898f\u8868\u73fe\u306e\u4f7f\u7528\u65b9\u6cd5\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-31\">\u6b63\u898f\u8868\u73fe\u3092\u4f7f\u3063\u305f\u9ad8\u5ea6\u306a\u6587\u5b57\u5217\u691c\u7d22<\/h2>\n\n\n\n<p>\u3088\u308a\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u30f3\u30b0\u304c\u5fc5\u8981\u306a\u5834\u5408\u3001PHP\u306e\u6b63\u898f\u8868\u73fe\u95a2\u6570\u304c\u5f37\u529b\u306a\u30c4\u30fc\u30eb\u3068\u306a\u308a\u307e\u3059\u3002\u6b63\u898f\u8868\u73fe\u3092\u4f7f\u3046\u3068\u3001\u5358\u7d14\u306a\u6587\u5b57\u5217\u95a2\u6570\u3067\u306f\u96e3\u3057\u3044\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u306e\u691c\u7d22\u3084\u62bd\u51fa\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002\u3053\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001PHP\u306b\u304a\u3051\u308b\u6b63\u898f\u8868\u73fe\u306e\u57fa\u672c\u304b\u3089\u5fdc\u7528\u307e\u3067\u3092\u5b9f\u8df5\u7684\u306a\u30b3\u30fc\u30c9\u4f8b\u3068\u3068\u3082\u306b\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-32\">preg_match()\u306e\u57fa\u672c\u3068\u5b9f\u88c5\u4f8b<\/h3>\n\n\n\n<p><code>preg_match()<\/code>\u95a2\u6570\u306f\u3001\u6587\u5b57\u5217\u304c\u7279\u5b9a\u306e\u30d1\u30bf\u30fc\u30f3\u306b\u4e00\u81f4\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3001\u6700\u521d\u306e\u30de\u30c3\u30c1\u3092\u53d6\u5f97\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=\"\">\/\/ preg_match(\u30d1\u30bf\u30fc\u30f3, \u5bfe\u8c61\u6587\u5b57\u5217, [\u30de\u30c3\u30c1\u7d50\u679c\u3092\u683c\u7d0d\u3059\u308b\u914d\u5217], [\u30d5\u30e9\u30b0], [\u958b\u59cb\u4f4d\u7f6e])\n$text = \"\u304a\u554f\u3044\u5408\u308f\u305b: contact@example.com \u307e\u3067\";\n\n\/\/ \u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u62bd\u51fa\u3059\u308b\u6b63\u898f\u8868\u73fe\n$pattern = '\/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}\/';\n\n\/\/ \u30de\u30c3\u30c1\u3092\u5b9f\u884c\nif (preg_match($pattern, $text, $matches)) {\n    echo \"\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f: \" . $matches[0]; \/\/ \u51fa\u529b: \u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f: contact@example.com\n} else {\n    echo \"\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\";\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-33\">\u6b63\u898f\u8868\u73fe\u30d1\u30bf\u30fc\u30f3\u306e\u57fa\u672c\u69cb\u9020<\/h4>\n\n\n\n<p>PHP\u306e\u6b63\u898f\u8868\u73fe\u30d1\u30bf\u30fc\u30f3\u306f\u901a\u5e38\u3001\u30b9\u30e9\u30c3\u30b7\u30e5\uff08\/\uff09\u3067\u56f2\u307e\u308c\u3001\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u4fee\u98fe\u5b50\u304c\u7d9a\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=\"\">\/\u30d1\u30bf\u30fc\u30f3\/\u4fee\u98fe\u5b50\n<\/pre>\n\n\n\n<p>\u4ee3\u8868\u7684\u306a\u4fee\u98fe\u5b50\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>i<\/code>: \u5927\u6587\u5b57\u30fb\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044<\/li>\n\n\n\n<li><code>m<\/code>: \u8907\u6570\u884c\u30e2\u30fc\u30c9\uff08^\u3068$\u304c\u5404\u884c\u306e\u5148\u982d\u3068\u672b\u5c3e\u306b\u30de\u30c3\u30c1\uff09<\/li>\n\n\n\n<li><code>s<\/code>: \u30c9\u30c3\u30c8\u304c\u6539\u884c\u306b\u3082\u30de\u30c3\u30c1\u3059\u308b<\/li>\n\n\n\n<li><code>u<\/code>: UTF-8\u30e2\u30fc\u30c9\uff08\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u306b\u5bfe\u5fdc\uff09<\/li>\n\n\n\n<li><code>x<\/code>: \u7a7a\u767d\u3068\u30b3\u30e1\u30f3\u30c8\u3092\u7121\u8996\uff08\u30d1\u30bf\u30fc\u30f3\u3092\u8aad\u307f\u3084\u3059\u304f\u8a18\u8ff0\u53ef\u80fd\uff09<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-34\">\u30ad\u30e3\u30d7\u30c1\u30e3\u30b0\u30eb\u30fc\u30d7\u306e\u5229\u7528<\/h4>\n\n\n\n<p>\u62ec\u5f27\u3067\u56f2\u3080\u3053\u3068\u3067\u3001\u30de\u30c3\u30c1\u3057\u305f\u90e8\u5206\u3092\u500b\u5225\u306b\u53d6\u5f97\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=\"\">$date_text = \"\u4e88\u7d04\u65e5: 2023-10-15 10:30\";\n$pattern = '\/(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2})\/';\n\nif (preg_match($pattern, $date_text, $matches)) {\n    print_r($matches);\n    \/\/ \u51fa\u529b\u4f8b:\n    \/\/ Array (\n    \/\/     [0] =&gt; 2023-10-15 10:30  \/\/ \u30de\u30c3\u30c1\u5168\u4f53\n    \/\/     [1] =&gt; 2023              \/\/ \u5e74\n    \/\/     [2] =&gt; 10                \/\/ \u6708\n    \/\/     [3] =&gt; 15                \/\/ \u65e5\n    \/\/     [4] =&gt; 10                \/\/ \u6642\n    \/\/     [5] =&gt; 30                \/\/ \u5206\n    \/\/ )\n    \n    echo \"\u65e5\u4ed8: {$matches[3]}\u65e5{$matches[2]}\u6708{$matches[1]}\u5e74\";\n    \/\/ \u51fa\u529b: \u65e5\u4ed8: 15\u65e510\u67082023\u5e74\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-35\">\u540d\u524d\u4ed8\u304d\u30ad\u30e3\u30d7\u30c1\u30e3\u30b0\u30eb\u30fc\u30d7<\/h4>\n\n\n\n<p>\u3088\u308a\u8aad\u307f\u3084\u3059\u304f\u3001\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u3057\u3084\u3059\u3044\u30b3\u30fc\u30c9\u306e\u305f\u3081\u306b\u3001\u540d\u524d\u4ed8\u304d\u30ad\u30e3\u30d7\u30c1\u30e3\u30b0\u30eb\u30fc\u30d7\u3092\u4f7f\u7528\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=\"\">$date_text = \"\u4e88\u7d04\u65e5: 2023-10-15 10:30\";\n$pattern = '\/(?P&lt;year&gt;\\d{4})-(?P&lt;month&gt;\\d{2})-(?P&lt;day&gt;\\d{2}) (?P&lt;hour&gt;\\d{2}):(?P&lt;minute&gt;\\d{2})\/';\n\nif (preg_match($pattern, $date_text, $matches)) {\n    echo \"\u5e74: {$matches['year']}\\n\";  \/\/ \u51fa\u529b: \u5e74: 2023\n    echo \"\u6708: {$matches['month']}\\n\"; \/\/ \u51fa\u529b: \u6708: 10\n    echo \"\u65e5: {$matches['day']}\\n\";   \/\/ \u51fa\u529b: \u65e5: 15\n    echo \"\u6642: {$matches['hour']}\\n\";  \/\/ \u51fa\u529b: \u6642: 10\n    echo \"\u5206: {$matches['minute']}\";  \/\/ \u51fa\u529b: \u5206: 30\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-36\">preg_match_all()\u3067\u8907\u6570\u306e\u30de\u30c3\u30c1\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5<\/h3>\n\n\n\n<p><code>preg_match()<\/code>\u306f\u6700\u521d\u306e\u30de\u30c3\u30c1\u306e\u307f\u3092\u8fd4\u3057\u307e\u3059\u304c\u3001<code>preg_match_all()<\/code>\u306f\u3059\u3079\u3066\u306e\u30de\u30c3\u30c1\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002\u3053\u308c\u306f\u8907\u6570\u306e\u8981\u7d20\u3092\u4e00\u5ea6\u306b\u62bd\u51fa\u3059\u308b\u969b\u306b\u7279\u306b\u4fbf\u5229\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=\"\">\/\/ preg_match_all(\u30d1\u30bf\u30fc\u30f3, \u5bfe\u8c61\u6587\u5b57\u5217, \u30de\u30c3\u30c1\u7d50\u679c\u3092\u683c\u7d0d\u3059\u308b\u914d\u5217, [\u30d5\u30e9\u30b0], [\u958b\u59cb\u4f4d\u7f6e])\n$html = '&lt;p&gt;PHP\u306f&lt;a href=\"https:\/\/www.php.net\"&gt;\u516c\u5f0f\u30b5\u30a4\u30c8&lt;\/a&gt;\u3084&lt;a href=\"https:\/\/www.example.com\"&gt;\u30b5\u30f3\u30d7\u30eb&lt;\/a&gt;\u304c\u3042\u308a\u307e\u3059\u3002&lt;\/p&gt;';\n\n\/\/ \u3059\u3079\u3066\u306e\u30ea\u30f3\u30afURL\u3092\u62bd\u51fa\n$pattern = '\/&lt;a href=\"([^\"]+)\"&gt;\/';\n\npreg_match_all($pattern, $html, $matches);\nprint_r($matches[1]); \/\/ URL\u306e\u307f\u3092\u53d6\u5f97\n\/\/ \u51fa\u529b:\n\/\/ Array (\n\/\/     [0] =&gt; https:\/\/www.php.net\n\/\/     [1] =&gt; https:\/\/www.example.com\n\/\/ )\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-37\">\u7d50\u679c\u914d\u5217\u306e\u69cb\u9020<\/h4>\n\n\n\n<p><code>preg_match_all()<\/code>\u306e\u7d50\u679c\u914d\u5217\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u69cb\u9020\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=\"\">$text = \"\u9023\u7d61\u51481: 080-1234-5678, \u9023\u7d61\u51482: 090-8765-4321\";\n$pattern = '\/(\\d{3})-(\\d{4})-(\\d{4})\/';\n\npreg_match_all($pattern, $text, $matches);\nprint_r($matches);\n\/\/ \u51fa\u529b:\n\/\/ Array (\n\/\/     [0] =&gt; Array (         \/\/ \u30de\u30c3\u30c1\u5168\u4f53\u306e\u914d\u5217\n\/\/         [0] =&gt; 080-1234-5678\n\/\/         [1] =&gt; 090-8765-4321\n\/\/     )\n\/\/     [1] =&gt; Array (         \/\/ \u6700\u521d\u306e\u30ad\u30e3\u30d7\u30c1\u30e3\u30b0\u30eb\u30fc\u30d7\u306e\u914d\u5217\n\/\/         [0] =&gt; 080\n\/\/         [1] =&gt; 090\n\/\/     )\n\/\/     [2] =&gt; Array (         \/\/ 2\u756a\u76ee\u306e\u30ad\u30e3\u30d7\u30c1\u30e3\u30b0\u30eb\u30fc\u30d7\u306e\u914d\u5217\n\/\/         [0] =&gt; 1234\n\/\/         [1] =&gt; 8765\n\/\/     )\n\/\/     [3] =&gt; Array (         \/\/ 3\u756a\u76ee\u306e\u30ad\u30e3\u30d7\u30c1\u30e3\u30b0\u30eb\u30fc\u30d7\u306e\u914d\u5217\n\/\/         [0] =&gt; 5678\n\/\/         [1] =&gt; 4321\n\/\/     )\n\/\/ )\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-38\">FLAGS\u30aa\u30d7\u30b7\u30e7\u30f3\u306b\u3088\u308b\u7d50\u679c\u5f62\u5f0f\u306e\u5909\u66f4<\/h4>\n\n\n\n<p><code>preg_match_all()<\/code>\u306e\u7b2c4\u5f15\u6570\uff08FLAGS\uff09\u3092\u4f7f\u7528\u3057\u3066\u3001\u7d50\u679c\u914d\u5217\u306e\u69cb\u9020\u3092\u5909\u66f4\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=\"\">$text = \"\u9023\u7d61\u51481: 080-1234-5678, \u9023\u7d61\u51482: 090-8765-4321\";\n$pattern = '\/(\\d{3})-(\\d{4})-(\\d{4})\/';\n\n\/\/ PREG_PATTERN_ORDER (\u30c7\u30d5\u30a9\u30eb\u30c8): \u30d1\u30bf\u30fc\u30f3\u9806\u306b\u7d50\u679c\u3092\u30b0\u30eb\u30fc\u30d7\u5316\npreg_match_all($pattern, $text, $matches1, PREG_PATTERN_ORDER);\n\n\/\/ PREG_SET_ORDER: \u30de\u30c3\u30c1\u3054\u3068\u306b\u7d50\u679c\u3092\u30b0\u30eb\u30fc\u30d7\u5316\npreg_match_all($pattern, $text, $matches2, PREG_SET_ORDER);\n\nprint_r($matches2);\n\/\/ \u51fa\u529b:\n\/\/ Array (\n\/\/     [0] =&gt; Array (         \/\/ 1\u756a\u76ee\u306e\u30de\u30c3\u30c1\u306e\u3059\u3079\u3066\u306e\u30b0\u30eb\u30fc\u30d7\n\/\/         [0] =&gt; 080-1234-5678\n\/\/         [1] =&gt; 080\n\/\/         [2] =&gt; 1234\n\/\/         [3] =&gt; 5678\n\/\/     )\n\/\/     [1] =&gt; Array (         \/\/ 2\u756a\u76ee\u306e\u30de\u30c3\u30c1\u306e\u3059\u3079\u3066\u306e\u30b0\u30eb\u30fc\u30d7\n\/\/         [0] =&gt; 090-8765-4321\n\/\/         [1] =&gt; 090\n\/\/         [2] =&gt; 8765\n\/\/         [3] =&gt; 4321\n\/\/     )\n\/\/ )\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-39\">\u6b63\u898f\u8868\u73fe\u30d1\u30bf\u30fc\u30f3\u306e\u4f5c\u6210\u30c6\u30af\u30cb\u30c3\u30af<\/h3>\n\n\n\n<p>\u52b9\u679c\u7684\u306a\u6b63\u898f\u8868\u73fe\u30d1\u30bf\u30fc\u30f3\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306e\u30c6\u30af\u30cb\u30c3\u30af\u3092\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-40\">\u4e00\u822c\u7684\u306a\u30e1\u30bf\u6587\u5b57\u3068\u7279\u6b8a\u30b7\u30fc\u30b1\u30f3\u30b9<\/h4>\n\n\n<div id=\"id-e723b25d-cebe-4ae5-ba11-a6b8faad03ae\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u30e1\u30bf\u6587\u5b57<\/th><th>\u8aac\u660e<\/th><\/tr><\/thead><tbody><tr><td><code>.<\/code><\/td><td>\u4efb\u610f\u306e1\u6587\u5b57\uff08\u6539\u884c\u3092\u9664\u304f\uff09<\/td><\/tr><tr><td><code>^<\/code><\/td><td>\u884c\u306e\u5148\u982d<\/td><\/tr><tr><td><code>$<\/code><\/td><td>\u884c\u306e\u672b\u5c3e<\/td><\/tr><tr><td><code>*<\/code><\/td><td>\u76f4\u524d\u306e\u6587\u5b57\u306e0\u56de\u4ee5\u4e0a\u306e\u7e70\u308a\u8fd4\u3057<\/td><\/tr><tr><td><code>+<\/code><\/td><td>\u76f4\u524d\u306e\u6587\u5b57\u306e1\u56de\u4ee5\u4e0a\u306e\u7e70\u308a\u8fd4\u3057<\/td><\/tr><tr><td><code>?<\/code><\/td><td>\u76f4\u524d\u306e\u6587\u5b57\u306e0\u56de\u307e\u305f\u306f1\u56de\u306e\u51fa\u73fe<\/td><\/tr><tr><td><code>{n}<\/code><\/td><td>\u76f4\u524d\u306e\u6587\u5b57\u306en\u56de\u306e\u7e70\u308a\u8fd4\u3057<\/td><\/tr><tr><td><code>{n,}<\/code><\/td><td>\u76f4\u524d\u306e\u6587\u5b57\u306en\u56de\u4ee5\u4e0a\u306e\u7e70\u308a\u8fd4\u3057<\/td><\/tr><tr><td><code>{n,m}<\/code><\/td><td>\u76f4\u524d\u306e\u6587\u5b57\u306en\u56de\u4ee5\u4e0am\u56de\u4ee5\u4e0b\u306e\u7e70\u308a\u8fd4\u3057<\/td><\/tr><tr><td><code>\\d<\/code><\/td><td>\u6570\u5b57 [0-9]<\/td><\/tr><tr><td><code>\\w<\/code><\/td><td>\u82f1\u6570\u5b57\u3068\u30a2\u30f3\u30c0\u30fc\u30b9\u30b3\u30a2 [a-zA-Z0-9_]<\/td><\/tr><tr><td><code>\\s<\/code><\/td><td>\u7a7a\u767d\u6587\u5b57<\/td><\/tr><tr><td><code>[...]<\/code><\/td><td>\u6587\u5b57\u30af\u30e9\u30b9\uff08\u62ec\u5f27\u5185\u306e\u4efb\u610f\u306e1\u6587\u5b57\uff09<\/td><\/tr><tr><td><code>[^...]<\/code><\/td><td>\u5426\u5b9a\u6587\u5b57\u30af\u30e9\u30b9\uff08\u62ec\u5f27\u5185\u4ee5\u5916\u306e\u4efb\u610f\u306e1\u6587\u5b57\uff09<\/td><\/tr><tr><td><code>(...)<\/code><\/td><td>\u30ad\u30e3\u30d7\u30c1\u30e3\u30b0\u30eb\u30fc\u30d7<\/td><\/tr><tr><td><code>(?:...)<\/code><\/td><td>\u975e\u30ad\u30e3\u30d7\u30c1\u30e3\u30b0\u30eb\u30fc\u30d7<\/td><\/tr><tr><td>`<\/td><td>`<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<h4 class=\"wp-block-heading\" id=\"i-41\">\u5b9f\u7528\u7684\u306a\u30d1\u30bf\u30fc\u30f3\u4f8b<\/h4>\n\n\n\n<h5 class=\"wp-block-heading\" id=\"i-42\">1. \u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306e\u691c\u8a3c\uff08\u57fa\u672c\u7248\uff09<\/h5>\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=\"\">$pattern = '\/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$\/';\n$email = 'user@example.com';\necho preg_match($pattern, $email) ? '\u6709\u52b9' : '\u7121\u52b9'; \/\/ \u51fa\u529b: \u6709\u52b9\n<\/pre>\n\n\n\n<h5 class=\"wp-block-heading\" id=\"i-43\">2. \u65e5\u672c\u306e\u90f5\u4fbf\u756a\u53f7\u5f62\u5f0f\u306e\u691c\u8a3c\uff08XXX-XXXX\uff09<\/h5>\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=\"\">$pattern = '\/^\\d{3}-\\d{4}$\/';\n$postal_code = '123-4567';\necho preg_match($pattern, $postal_code) ? '\u6709\u52b9' : '\u7121\u52b9'; \/\/ \u51fa\u529b: \u6709\u52b9\n<\/pre>\n\n\n\n<h5 class=\"wp-block-heading\" id=\"i-44\">3. HTML\u30bf\u30b0\u306e\u62bd\u51fa<\/h5>\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 = '&lt;div class=\"content\"&gt;&lt;p&gt;PHP\u306e&lt;strong&gt;\u6b63\u898f\u8868\u73fe&lt;\/strong&gt;\u306b\u3064\u3044\u3066&lt;\/p&gt;&lt;\/div&gt;';\n$pattern = '\/&lt;([a-z][a-z0-9]*)[^&gt;]*&gt;.*?&lt;\\\/\\1&gt;\/is';\n\npreg_match_all($pattern, $html, $matches);\nprint_r($matches[0]);\n\/\/ \u51fa\u529b:\n\/\/ Array (\n\/\/     [0] =&gt; &lt;div class=\"content\"&gt;&lt;p&gt;PHP\u306e&lt;strong&gt;\u6b63\u898f\u8868\u73fe&lt;\/strong&gt;\u306b\u3064\u3044\u3066&lt;\/p&gt;&lt;\/div&gt;\n\/\/     [1] =&gt; &lt;p&gt;PHP\u306e&lt;strong&gt;\u6b63\u898f\u8868\u73fe&lt;\/strong&gt;\u306b\u3064\u3044\u3066&lt;\/p&gt;\n\/\/     [2] =&gt; &lt;strong&gt;\u6b63\u898f\u8868\u73fe&lt;\/strong&gt;\n\/\/ )\n<\/pre>\n\n\n\n<h5 class=\"wp-block-heading\" id=\"i-45\">4. \u5148\u8aad\u307f\u30fb\u5f8c\u8aad\u307f\u3092\u4f7f\u3063\u305f\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3<\/h5>\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=\"\">\/\/ \u300cPHP\u30a8\u30f3\u30b8\u30cb\u30a2\u300d\u306e\u524d\u306b\u300c\u30b7\u30cb\u30a2\u300d\u304c\u3042\u308b\u5834\u5408\u306e\u307f\u30de\u30c3\u30c1\n$text = \"\u5f53\u793e\u3067\u306f\u30b7\u30cb\u30a2PHP\u30a8\u30f3\u30b8\u30cb\u30a2\u3092\u52df\u96c6\u3057\u3066\u3044\u307e\u3059\u3002PHP\u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u7d4c\u9a13\u8005\u6b53\u8fce\u3002\";\n$pattern = '\/(?&lt;=\u30b7\u30cb\u30a2)PHP\u30a8\u30f3\u30b8\u30cb\u30a2\/';\n\npreg_match_all($pattern, $text, $matches);\nprint_r($matches[0]);\n\/\/ \u51fa\u529b:\n\/\/ Array (\n\/\/     [0] =&gt; PHP\u30a8\u30f3\u30b8\u30cb\u30a2\n\/\/ )\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-46\">\u6b63\u898f\u8868\u73fe\u306e\u4f7f\u7528\u306b\u95a2\u3059\u308b\u6ce8\u610f\u70b9<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9<\/strong>: \u8907\u96d1\u306a\u6b63\u898f\u8868\u73fe\u306f\u51e6\u7406\u306b\u6642\u9593\u304c\u304b\u304b\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002\u53ef\u80fd\u306a\u9650\u308a\u5358\u7d14\u5316\u3057\u307e\u3057\u3087\u3046\u3002<\/li>\n\n\n\n<li><strong>\u53ef\u8aad\u6027<\/strong>: \u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u306f<code>x<\/code>\u4fee\u98fe\u5b50\u3068\u30b3\u30e1\u30f3\u30c8\u3092\u4f7f\u7528\u3057\u3066\u8aad\u307f\u3084\u3059\u304f\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u30d0\u30c3\u30af\u30c8\u30e9\u30c3\u30af<\/strong>: \u8caa\u6b32\u306a\u91cf\u6307\u5b9a\u5b50(<code>*<\/code>, <code>+<\/code>)\u306e\u904e\u5270\u4f7f\u7528\u306f\u3001\u30d0\u30c3\u30af\u30c8\u30e9\u30c3\u30af\u306e\u7206\u767a\u3092\u5f15\u304d\u8d77\u3053\u3059\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u518d\u5229\u7528<\/strong>: \u983b\u7e41\u306b\u4f7f\u7528\u3059\u308b\u30d1\u30bf\u30fc\u30f3\u306f\u5909\u6570\u3084\u5b9a\u6570\u3068\u3057\u3066\u5b9a\u7fa9\u3057\u307e\u3057\u3087\u3046\u3002<\/li>\n\n\n\n<li><strong>\u691c\u8a3c<\/strong>: \u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u306f\u30aa\u30f3\u30e9\u30a4\u30f3\u6b63\u898f\u8868\u73fe\u30c6\u30b9\u30bf\u30fc\u3067\u4e8b\u524d\u306b\u691c\u8a3c\u3059\u308b\u306e\u304c\u826f\u3044\u7fd2\u6163\u3067\u3059\u3002<\/li>\n<\/ol>\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=\"\">\/\/ \u30b3\u30e1\u30f3\u30c8\u4ed8\u304d\u306e\u8907\u96d1\u306a\u6b63\u898f\u8868\u73fe\uff08x\u4fee\u98fe\u5b50\u4f7f\u7528\uff09\n$pattern = '\/\n    (\\d{4})    # \u5e74\uff084\u6841\uff09\n    -          # \u533a\u5207\u308a\u6587\u5b57\n    (\\d{2})    # \u6708\uff082\u6841\uff09\n    -          # \u533a\u5207\u308a\u6587\u5b57\n    (\\d{2})    # \u65e5\uff082\u6841\uff09\n    \\s+        # 1\u3064\u4ee5\u4e0a\u306e\u7a7a\u767d\n    (\\d{2})    # \u6642\uff082\u6841\uff09\n    :          # \u533a\u5207\u308a\u6587\u5b57\n    (\\d{2})    # \u5206\uff082\u6841\uff09\n\/x';\n\n$text = \"\u4f1a\u8b70\u65e5\u6642: 2023-10-15 14:30\";\npreg_match($pattern, $text, $matches);\nprint_r($matches);\n<\/pre>\n\n\n\n<p>\u6b63\u898f\u8868\u73fe\u306f\u5f37\u529b\u3067\u3059\u304c\u3001\u5fc5\u305a\u3057\u3082\u6700\u9069\u306a\u9078\u629e\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u5358\u7d14\u306a\u30d1\u30bf\u30fc\u30f3\u306b\u306f\u57fa\u672c\u7684\u306a\u6587\u5b57\u5217\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3001\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u306b\u306e\u307f\u6b63\u898f\u8868\u73fe\u3092\u4f7f\u7528\u3059\u308b\u306e\u304c\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3067\u3059\u3002\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u6587\u5b57\u5217\u691c\u7d22\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316\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-47\">\u6587\u5b57\u5217\u691c\u7d22\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316<\/h2>\n\n\n\n<p>PHP\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u306f\u3001\u7279\u306b\u5927\u91cf\u306e\u30c6\u30ad\u30b9\u30c8\u30c7\u30fc\u30bf\u3092\u51e6\u7406\u3059\u308b\u5834\u5408\u3001\u6587\u5b57\u5217\u691c\u7d22\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u5168\u4f53\u306e\u5fdc\u7b54\u6642\u9593\u306b\u5927\u304d\u306a\u5f71\u97ff\u3092\u4e0e\u3048\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u6587\u5b57\u5217\u691c\u7d22\u306e\u52b9\u7387\u3092\u9ad8\u3081\u3001\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\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-48\">\u5404\u691c\u7d22\u95a2\u6570\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6bd4\u8f03<\/h3>\n\n\n\n<p>PHP\u306e\u6587\u5b57\u5217\u691c\u7d22\u95a2\u6570\u306f\u3001\u5185\u90e8\u5b9f\u88c5\u3084\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306e\u9055\u3044\u306b\u3088\u308a\u3001\u5b9f\u884c\u901f\u5ea6\u306b\u5927\u304d\u306a\u5dee\u304c\u3042\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u306f\u3001\u4e00\u822c\u7684\u306a\u691c\u7d22\u95a2\u6570\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6bd4\u8f03\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=\"\">\/\/ \u691c\u7d22\u95a2\u6570\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6bd4\u8f03\nfunction benchmark_string_functions($haystack, $needle, $iterations = 100000) {\n    $functions = [\n        'strpos' =&gt; function($h, $n) { return strpos($h, $n); },\n        'str_contains' =&gt; function($h, $n) { return str_contains($h, $n); },\n        'stripos' =&gt; function($h, $n) { return stripos($h, $n); },\n        'strstr' =&gt; function($h, $n) { return strstr($h, $n); },\n        'preg_match' =&gt; function($h, $n) { return preg_match('\/' . preg_quote($n, '\/') . '\/', $h); },\n        'mb_strpos' =&gt; function($h, $n) { return mb_strpos($h, $n); }\n    ];\n    \n    $results = [];\n    \n    foreach ($functions as $name =&gt; $func) {\n        \/\/ PHP 8.0\u672a\u6e80\u3067\u306fstr_contains()\u306f\u4f7f\u7528\u3067\u304d\u306a\u3044\n        if ($name === 'str_contains' &amp;&amp; !function_exists('str_contains')) {\n            $results[$name] = 'Not available';\n            continue;\n        }\n        \n        $start = microtime(true);\n        for ($i = 0; $i &lt; $iterations; $i++) {\n            $func($haystack, $needle);\n        }\n        $results[$name] = microtime(true) - $start;\n    }\n    \n    return $results;\n}\n\n\/\/ \u30c6\u30b9\u30c8\u5b9f\u884c\n$haystack = \"PHP\u958b\u767a\u8005\u306e\u305f\u3081\u306e\u6587\u5b57\u5217\u691c\u7d22\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316\u30ac\u30a4\u30c9\";\n$needle = \"\u6587\u5b57\u5217\u691c\u7d22\";\n$results = benchmark_string_functions($haystack, $needle);\n\n\/\/ \u7d50\u679c\u3092\u8868\u793a\narsort($results);\nforeach ($results as $function =&gt; $time) {\n    echo \"$function: \" . number_format($time, 6) . \" \u79d2\\n\";\n}\n<\/pre>\n\n\n\n<p>\u5178\u578b\u7684\u306a\u5b9f\u884c\u7d50\u679c\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u9806\u5e8f\u306b\u306a\u308a\u307e\u3059\uff08\u901f\u3044\u9806\uff09\uff1a<\/p>\n\n\n<div id=\"id-3d5220c2-b505-446e-bc23-dd2eae147fa2\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u95a2\u6570<\/th><th>\u76f8\u5bfe\u901f\u5ea6<\/th><th>\u5099\u8003<\/th><\/tr><\/thead><tbody><tr><td>strpos()<\/td><td>\u6700\u901f (1x)<\/td><td>\u5358\u7d14\u306a\u691c\u7d22\u3067\u6700\u3082\u52b9\u7387\u7684<\/td><\/tr><tr><td>str_contains()<\/td><td>\u975e\u5e38\u306b\u9ad8\u901f (1.1x)<\/td><td>PHP 8.0\u4ee5\u964d\u3067\u4f7f\u7528\u53ef\u80fd\u3001\u8aad\u307f\u3084\u3059\u3044<\/td><\/tr><tr><td>stripos()<\/td><td>\u4e2d\u901f (2-3x)<\/td><td>\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22<\/td><\/tr><tr><td>strstr()<\/td><td>\u3084\u3084\u9045\u3044 (3-4x)<\/td><td>\u691c\u7d22\u3068\u540c\u6642\u306b\u90e8\u5206\u6587\u5b57\u5217\u3092\u53d6\u5f97<\/td><\/tr><tr><td>preg_match()<\/td><td>\u9045\u3044 (10-15x)<\/td><td>\u6b63\u898f\u8868\u73fe\u30a8\u30f3\u30b8\u30f3\u306e\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9<\/td><\/tr><tr><td>mb_strpos()<\/td><td>\u975e\u5e38\u306b\u9045\u3044 (20-30x)<\/td><td>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u51e6\u7406\u306e\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<p>\u3053\u306e\u7d50\u679c\u304b\u3089\u3001\u4ee5\u4e0b\u306e\u9078\u629e\u57fa\u6e96\u304c\u63a8\u5968\u3055\u308c\u307e\u3059\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u5358\u7d14\u306a\u6587\u5b57\u5217\u691c\u7d22: <code>strpos()<\/code> \u307e\u305f\u306f <code>str_contains()<\/code>\uff08PHP 8.0\u4ee5\u964d\uff09<\/li>\n\n\n\n<li>\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22: <code>stripos()<\/code><\/li>\n\n\n\n<li>\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u691c\u7d22: <code>preg_match()<\/code>\uff08\u5fc5\u8981\u306a\u5834\u5408\u306e\u307f\uff09<\/li>\n\n\n\n<li>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u691c\u7d22: <code>mb_strpos()<\/code>\uff08\u5fc5\u8981\u306a\u5834\u5408\u306e\u307f\uff09<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-49\">\u5927\u91cf\u30c6\u30ad\u30b9\u30c8\u51e6\u7406\u306b\u304a\u3051\u308b\u6700\u9069\u5316\u624b\u6cd5<\/h3>\n\n\n\n<p>\u5927\u91cf\u306e\u30c6\u30ad\u30b9\u30c8\u3092\u51e6\u7406\u3059\u308b\u5834\u5408\u3001\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3068\u51e6\u7406\u6642\u9593\u306e\u4e21\u65b9\u3092\u8003\u616e\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u306f\u52b9\u679c\u7684\u306a\u6700\u9069\u5316\u30c6\u30af\u30cb\u30c3\u30af\u3067\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-50\">1. \u30c1\u30e3\u30f3\u30af\u51e6\u7406\uff08\u5206\u5272\u51e6\u7406\uff09<\/h4>\n\n\n\n<p>\u5927\u304d\u306a\u30d5\u30a1\u30a4\u30eb\u3084\u30c6\u30ad\u30b9\u30c8\u3092\u4e00\u5ea6\u306b\u8aad\u307f\u8fbc\u3080\u306e\u3067\u306f\u306a\u304f\u3001\u30c1\u30e3\u30f3\u30af\uff08\u5c0f\u3055\u306a\u90e8\u5206\uff09\u306b\u5206\u5272\u3057\u3066\u51e6\u7406\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=\"\">function search_in_large_file($file_path, $search_term) {\n    $handle = fopen($file_path, 'r');\n    $chunk_size = 1024 * 1024; \/\/ 1MB\u305a\u3064\u8aad\u307f\u8fbc\u3080\n    $line_number = 0;\n    $results = [];\n    \n    if ($handle) {\n        while (!feof($handle)) {\n            $chunk = fread($handle, $chunk_size);\n            $lines = explode(\"\\n\", $chunk);\n            \n            foreach ($lines as $line) {\n                $line_number++;\n                if (strpos($line, $search_term) !== false) {\n                    $results[] = [\n                        'line' =&gt; $line_number,\n                        'content' =&gt; $line\n                    ];\n                }\n            }\n        }\n        fclose($handle);\n    }\n    \n    return $results;\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-51\">2. \u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u306e\u4f7f\u7528<\/h4>\n\n\n\n<p>\u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u4e00\u5ea6\u306b\u30e1\u30e2\u30ea\u306b\u8aad\u307f\u8fbc\u307e\u305a\u306b\u51e6\u7406\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=\"\">function search_lines_generator($file_path, $search_term) {\n    $handle = fopen($file_path, 'r');\n    $line_number = 0;\n    \n    if ($handle) {\n        while (($line = fgets($handle)) !== false) {\n            $line_number++;\n            if (strpos($line, $search_term) !== false) {\n                yield [\n                    'line' =&gt; $line_number,\n                    'content' =&gt; trim($line)\n                ];\n            }\n        }\n        fclose($handle);\n    }\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$file_path = 'large_log_file.txt';\n$search_term = 'ERROR';\n\nforeach (search_lines_generator($file_path, $search_term) as $result) {\n    echo \"Line {$result['line']}: {$result['content']}\\n\";\n    \n    \/\/ \u6700\u521d\u306e10\u4ef6\u3060\u3051\u8868\u793a\u3057\u3066\u7d42\u4e86\u3059\u308b\u4f8b\n    if ($result['line'] &gt;= 10) {\n        break;\n    }\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-52\">3. \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u4e8b\u524d\u69cb\u7bc9<\/h4>\n\n\n\n<p>\u983b\u7e41\u306b\u691c\u7d22\u3092\u884c\u3046\u5834\u5408\u306f\u3001\u691c\u7d22\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4e8b\u524d\u306b\u69cb\u7bc9\u3057\u3066\u304a\u304f\u3068\u3001\u691c\u7d22\u901f\u5ea6\u304c\u5927\u5e45\u306b\u5411\u4e0a\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=\"\">function build_search_index($text) {\n    $index = [];\n    $words = str_word_count(strtolower($text), 1);\n    $position = 0;\n    \n    foreach ($words as $word) {\n        if (!isset($index[$word])) {\n            $index[$word] = [];\n        }\n        $index[$word][] = $position;\n        $position++;\n    }\n    \n    return $index;\n}\n\nfunction search_using_index($index, $term) {\n    $term = strtolower($term);\n    return isset($index[$term]) ? $index[$term] : [];\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$text = file_get_contents('document.txt');\n$index = build_search_index($text);\n\n\/\/ \u691c\u7d22\n$positions = search_using_index($index, 'php');\nprint_r($positions); \/\/ 'php'\u3068\u3044\u3046\u5358\u8a9e\u306e\u51fa\u73fe\u4f4d\u7f6e\u306e\u914d\u5217\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-53\">4. \u65e9\u671f\u30ea\u30bf\u30fc\u30f3\u6226\u7565<\/h4>\n\n\n\n<p>\u6587\u5b57\u5217\u304c\u898b\u3064\u304b\u3063\u305f\u3089\u3059\u3050\u306b\u51e6\u7406\u3092\u7d42\u4e86\u3059\u308b\u3053\u3068\u3067\u3001\u4e0d\u8981\u306a\u691c\u7d22\u51e6\u7406\u3092\u7701\u7565\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=\"\">function contains_any_keywords($text, $keywords) {\n    foreach ($keywords as $keyword) {\n        if (strpos($text, $keyword) !== false) {\n            return true; \/\/ \u3044\u305a\u308c\u304b\u306e\u30ad\u30fc\u30ef\u30fc\u30c9\u304c\u898b\u3064\u304b\u3063\u305f\u6642\u70b9\u3067\u7d42\u4e86\n        }\n    }\n    return false;\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$text = \"PHP\u3067Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u958b\u767a\";\n$keywords = [\"Java\", \"Python\", \"PHP\", \"Ruby\"];\n\nif (contains_any_keywords($text, $keywords)) {\n    echo \"\u30ad\u30fc\u30ef\u30fc\u30c9\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\";\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-54\">\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3092\u6291\u3048\u305f\u52b9\u7387\u7684\u306a\u691c\u7d22\u5b9f\u88c5<\/h3>\n\n\n\n<p>\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u6271\u3046\u969b\u306f\u3001\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3092\u6291\u3048\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002\u4ee5\u4e0b\u306f\u3001\u30e1\u30e2\u30ea\u52b9\u7387\u306e\u826f\u3044\u5b9f\u88c5\u30c6\u30af\u30cb\u30c3\u30af\u3067\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-55\">1. \u30b9\u30c8\u30ea\u30fc\u30e0\u51e6\u7406<\/h4>\n\n\n\n<p>PHP\u306e\u30b9\u30c8\u30ea\u30fc\u30e0\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u3001\u5927\u304d\u306a\u30d5\u30a1\u30a4\u30eb\u3092\u52b9\u7387\u7684\u306b\u51e6\u7406\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=\"\">function count_occurrences_in_file($file_path, $search_term) {\n    $handle = fopen($file_path, 'r');\n    $chunk_size = 8192; \/\/ 8KB\u305a\u3064\u8aad\u307f\u8fbc\u3080\n    $count = 0;\n    $buffer = '';\n    \n    if ($handle) {\n        while (!feof($handle)) {\n            $chunk = fread($handle, $chunk_size);\n            $buffer .= $chunk;\n            \n            \/\/ \u691c\u7d22\u8a9e\u304c\u5b8c\u5168\u306b\u542b\u307e\u308c\u308b\u90e8\u5206\u307e\u3067\u30d0\u30c3\u30d5\u30a1\u3092\u51e6\u7406\n            $last_pos = 0;\n            while (($pos = strpos($buffer, $search_term, $last_pos)) !== false) {\n                $count++;\n                $last_pos = $pos + 1;\n            }\n            \n            \/\/ \u30d0\u30c3\u30d5\u30a1\u306e\u672b\u5c3e\u3092\u4fdd\u6301\uff08\u691c\u7d22\u8a9e\u304c\u5206\u5272\u3055\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u305f\u3081\uff09\n            $buffer = substr($buffer, -strlen($search_term) + 1);\n        }\n        fclose($handle);\n    }\n    \n    return $count;\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-56\">2. \u53c2\u7167\u6e21\u3057\u3092\u5229\u7528\u3057\u305f\u52b9\u7387\u7684\u306a\u51e6\u7406<\/h4>\n\n\n\n<p>\u5927\u304d\u306a\u6587\u5b57\u5217\u3084\u914d\u5217\u3092\u95a2\u6570\u306b\u6e21\u3059\u969b\u306f\u3001\u53c2\u7167\u6e21\u3057\u3092\u4f7f\u7528\u3057\u3066\u30e1\u30e2\u30ea\u30b3\u30d4\u30fc\u3092\u907f\u3051\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=\"\">function extract_all_emails(&amp;$text, &amp;$results) {\n    $pattern = '\/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}\/';\n    return preg_match_all($pattern, $text, $results);\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$large_text = file_get_contents('emails.txt');\n$matches = [];\n$count = extract_all_emails($large_text, $matches);\necho \"\u898b\u3064\u304b\u3063\u305f\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u6570: $count\";\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-57\">3. \u90e8\u5206\u6587\u5b57\u5217\u306e\u691c\u7d22\u6700\u9069\u5316<\/h4>\n\n\n\n<p>\u9577\u3044\u6587\u5b57\u5217\u5185\u3067\u90e8\u5206\u6587\u5b57\u5217\u3092\u691c\u7d22\u3059\u308b\u5834\u5408\u3001\u4e8c\u5206\u63a2\u7d22\u306e\u30a2\u30d7\u30ed\u30fc\u30c1\u304c\u52b9\u679c\u7684\u306a\u5834\u5408\u304c\u3042\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=\"\">function binary_search_substring($haystack, $needle, $chunk_size = 1024) {\n    $length = strlen($haystack);\n    $chunks = ceil($length \/ $chunk_size);\n    \n    for ($i = 0; $i &lt; $chunks; $i++) {\n        $start = $i * $chunk_size;\n        $chunk = substr($haystack, $start, $chunk_size + strlen($needle) - 1);\n        \n        if (strpos($chunk, $needle) !== false) {\n            return true;\n        }\n    }\n    \n    return false;\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-58\">\u5b9f\u969b\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30c6\u30b9\u30c8\u3068\u9078\u629e\u57fa\u6e96<\/h3>\n\n\n\n<p>\u4ee5\u4e0b\u306b\u3001\u5b9f\u969b\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u306e\u6587\u5b57\u5217\u691c\u7d22\u95a2\u6570\u306e\u9078\u629e\u57fa\u6e96\u3092\u307e\u3068\u3081\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-59\">\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u5225\u306e\u6700\u9069\u95a2\u6570\u9078\u629e<\/h4>\n\n\n<div id=\"id-a8aa56ec-5871-4bf9-b5dc-22074d7e8492\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9<\/th><th>\u63a8\u5968\u95a2\u6570<\/th><th>\u4ee3\u66ff\u95a2\u6570<\/th><th>\u7406\u7531<\/th><\/tr><\/thead><tbody><tr><td>\u5358\u7d14\u306a\u5b58\u5728\u78ba\u8a8d\uff08PHP 8.0+\uff09<\/td><td>str_contains()<\/td><td>strpos()<\/td><td>\u53ef\u8aad\u6027\u3068\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306e\u30d0\u30e9\u30f3\u30b9<\/td><\/tr><tr><td>\u5358\u7d14\u306a\u5b58\u5728\u78ba\u8a8d\uff08PHP 7.x\u4ee5\u524d\uff09<\/td><td>strpos()<\/td><td>\u2013<\/td><td>\u6700\u9ad8\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9<\/td><\/tr><tr><td>\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22<\/td><td>stripos()<\/td><td>strtolower() + strpos()<\/td><td>\u3088\u308a\u52b9\u7387\u7684\u306a\u5b9f\u88c5<\/td><\/tr><tr><td>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\uff08\u65e5\u672c\u8a9e\u306a\u3069\uff09<\/td><td>mb_strpos()<\/td><td>\u2013<\/td><td>\u6b63\u78ba\u306a\u6587\u5b57\u51e6\u7406\u304c\u5fc5\u8981<\/td><\/tr><tr><td>\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3<\/td><td>preg_match()<\/td><td>\u2013<\/td><td>\u67d4\u8edf\u6027\u304c\u5fc5\u8981\u306a\u5834\u5408\u306e\u307f<\/td><\/tr><tr><td>\u5927\u91cf\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u691c\u7d22<\/td><td>\u30b8\u30a7\u30cd\u30ec\u30fc\u30bf + strpos()<\/td><td>grep (\u30b7\u30a7\u30eb)<\/td><td>\u30e1\u30e2\u30ea\u52b9\u7387<\/td><\/tr><tr><td>\u8907\u6570\u30ad\u30fc\u30ef\u30fc\u30c9<\/td><td>\u5c02\u7528\u30a4\u30f3\u30c7\u30c3\u30af\u30b9<\/td><td>foreach + strpos()<\/td><td>\u691c\u7d22\u983b\u5ea6\u304c\u9ad8\u3044\u5834\u5408<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<h4 class=\"wp-block-heading\" id=\"i-60\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30c6\u30b9\u30c8\u4f8b<\/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=\"\">\/\/ 100MB\u306e\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3067\u5404\u95a2\u6570\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u691c\u8a3c\nfunction test_large_file_search($file_path, $search_term) {\n    echo \"\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba: \" . filesize($file_path) . \" \u30d0\u30a4\u30c8\\n\";\n    \n    \/\/ 1. \u5168\u30d5\u30a1\u30a4\u30eb\u8aad\u307f\u8fbc\u307f + strpos\n    $start = microtime(true);\n    $content = file_get_contents($file_path);\n    $found = strpos($content, $search_term) !== false;\n    echo \"\u5168\u30d5\u30a1\u30a4\u30eb\u8aad\u307f\u8fbc\u307f + strpos: \" . (microtime(true) - $start) . \" \u79d2\\n\";\n    \n    \/\/ 2. \u30b9\u30c8\u30ea\u30fc\u30e0\u8aad\u307f\u8fbc\u307f + \u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\n    $start = microtime(true);\n    $found = false;\n    $handle = fopen($file_path, 'r');\n    while (!$found &amp;&amp; ($line = fgets($handle)) !== false) {\n        if (strpos($line, $search_term) !== false) {\n            $found = true;\n        }\n    }\n    fclose($handle);\n    echo \"\u30b9\u30c8\u30ea\u30fc\u30e0\u8aad\u307f\u8fbc\u307f + \u65e9\u671f\u30ea\u30bf\u30fc\u30f3: \" . (microtime(true) - $start) . \" \u79d2\\n\";\n    \n    \/\/ 3. \u6b63\u898f\u8868\u73fe\n    $start = microtime(true);\n    $found = false;\n    $handle = fopen($file_path, 'r');\n    while (!$found &amp;&amp; ($line = fgets($handle)) !== false) {\n        if (preg_match('\/' . preg_quote($search_term, '\/') . '\/', $line)) {\n            $found = true;\n        }\n    }\n    fclose($handle);\n    echo \"\u30b9\u30c8\u30ea\u30fc\u30e0\u8aad\u307f\u8fbc\u307f + \u6b63\u898f\u8868\u73fe: \" . (microtime(true) - $start) . \" \u79d2\\n\";\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-61\">\u30ea\u30a2\u30eb\u30ef\u30fc\u30eb\u30c9\u3067\u306e\u6700\u9069\u5316\u4e8b\u4f8b<\/h3>\n\n\n\n<p>\u5b9f\u969b\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u6700\u9069\u5316\u304c\u52b9\u679c\u7684\u3067\u3059\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u691c\u7d22\u5bfe\u8c61\u3092\u9650\u5b9a\u3059\u308b<\/strong>: \u5168\u6587\u691c\u7d22\u3088\u308a\u3082\u3001\u7279\u5b9a\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u3084\u30bb\u30af\u30b7\u30e7\u30f3\u306b\u9650\u5b9a\u3059\u308b<\/li>\n\n\n\n<li><strong>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u6d3b\u7528\u3059\u308b<\/strong>: \u5927\u91cf\u306e\u30c6\u30ad\u30b9\u30c8\u30c7\u30fc\u30bf\u306f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u5168\u6587\u691c\u7d22\u6a5f\u80fd\u3092\u4f7f\u7528\u3059\u308b<\/li>\n\n\n\n<li><strong>\u30ad\u30e3\u30c3\u30b7\u30e5\u6226\u7565<\/strong>: \u983b\u7e41\u306b\u691c\u7d22\u3055\u308c\u308b\u30d1\u30bf\u30fc\u30f3\u306e\u7d50\u679c\u3092\u30ad\u30e3\u30c3\u30b7\u30e5\u3059\u308b<\/li>\n\n\n\n<li><strong>\u4e26\u5217\u51e6\u7406<\/strong>: \u5927\u91cf\u30c7\u30fc\u30bf\u306e\u5834\u5408\u306f\u3001\u30de\u30eb\u30c1\u30b9\u30ec\u30c3\u30c9\u3084\u975e\u540c\u671f\u51e6\u7406\u3092\u691c\u8a0e\u3059\u308b<\/li>\n<\/ol>\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\u30c3\u30b7\u30e5\u3092\u6d3b\u7528\u3057\u305f\u52b9\u7387\u7684\u306a\u691c\u7d22\nfunction cached_search($text, $pattern, $cache_ttl = 3600) {\n    $cache_key = md5($text . '|' . $pattern);\n    \n    \/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u304c\u3042\u308c\u3070\u4f7f\u7528\n    if (apc_exists($cache_key)) {\n        return apc_fetch($cache_key);\n    }\n    \n    \/\/ \u306a\u3051\u308c\u3070\u691c\u7d22\u3092\u5b9f\u884c\n    $result = strpos($text, $pattern) !== false;\n    \n    \/\/ \u7d50\u679c\u3092\u30ad\u30e3\u30c3\u30b7\u30e5\n    apc_store($cache_key, $result, $cache_ttl);\n    \n    return $result;\n}\n<\/pre>\n\n\n\n<p>\u6587\u5b57\u5217\u691c\u7d22\u306e\u6700\u9069\u5316\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3068\u5fdc\u7b54\u6027\u306b\u5927\u304d\u306a\u5f71\u97ff\u3092\u4e0e\u3048\u307e\u3059\u3002\u7279\u306b\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u6271\u3046\u30b7\u30b9\u30c6\u30e0\u3067\u306f\u3001\u9069\u5207\u306a\u95a2\u6570\u9078\u629e\u3068\u30e1\u30e2\u30ea\u6700\u9069\u5316\u304c\u91cd\u8981\u3067\u3059\u3002\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u3053\u308c\u3089\u306e\u6280\u8853\u3092\u5b9f\u969b\u306e\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u306b\u9069\u7528\u3059\u308b\u65b9\u6cd5\u3092\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-62\">\u5b9f\u8df5\u7684\u306a\u5fdc\u7528\u4f8b\uff1a\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u5225\u306e\u6587\u5b57\u5217\u691c\u7d22\u5b9f\u88c5<\/h2>\n\n\n\n<p>\u6587\u5b57\u5217\u691c\u7d22\u306e\u6280\u8853\u306f\u3001\u5b9f\u969b\u306ePHP\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306b\u304a\u3044\u3066\u69d8\u3005\u306a\u5834\u9762\u3067\u6d3b\u7528\u3055\u308c\u307e\u3059\u3002\u3053\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u3088\u304f\u3042\u308b\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u306b\u304a\u3051\u308b\u6587\u5b57\u5217\u691c\u7d22\u306e\u5b9f\u88c5\u65b9\u6cd5\u3068\u3001\u305d\u308c\u305e\u308c\u306e\u72b6\u6cc1\u306b\u6700\u9069\u306a\u30a2\u30d7\u30ed\u30fc\u30c1\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-63\">Web\u30d5\u30a9\u30fc\u30e0\u306e\u5165\u529b\u691c\u8a3c\u306b\u304a\u3051\u308b\u6587\u5b57\u5217\u691c\u7d22<\/h3>\n\n\n\n<p>\u30e6\u30fc\u30b6\u30fc\u304b\u3089\u306e\u5165\u529b\u3092\u691c\u8a3c\u3059\u308b\u969b\u3001\u6587\u5b57\u5217\u691c\u7d22\u306f\u4e0d\u6b63\u306a\u5165\u529b\u306e\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u3084\u5f62\u5f0f\u306e\u78ba\u8a8d\u306b\u91cd\u8981\u306a\u5f79\u5272\u3092\u679c\u305f\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-64\">\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306e\u691c\u8a3c<\/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=\"\">\/\/ \u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306e\u57fa\u672c\u7684\u306a\u691c\u8a3c\nfunction validate_email($email) {\n    \/\/ \u7d44\u307f\u8fbc\u307f\u95a2\u6570\u3092\u4f7f\u7528\uff08\u63a8\u5968\uff09\n    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {\n        return false;\n    }\n    \n    \/\/ \u8ffd\u52a0\u306e\u30ab\u30b9\u30bf\u30e0\u691c\u8a3c\uff08\u7279\u5b9a\u306e\u30c9\u30e1\u30a4\u30f3\u3092\u8a31\u53ef\/\u62d2\u5426\uff09\n    $domain = substr(strstr($email, '@'), 1);\n    \n    \/\/ \u7981\u6b62\u30c9\u30e1\u30a4\u30f3\u306e\u30c1\u30a7\u30c3\u30af\n    $blocked_domains = ['example.com', 'temp-mail.org', 'disposable.com'];\n    if (in_array($domain, $blocked_domains)) {\n        return false;\n    }\n    \n    return true;\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-65\">\u4e0d\u9069\u5207\u306a\u5185\u5bb9\u306e\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0<\/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=\"\">\/\/ \u30b3\u30e1\u30f3\u30c8\u306a\u3069\u306e\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u304b\u3089\u4e0d\u9069\u5207\u306a\u5358\u8a9e\u3092\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\nfunction filter_inappropriate_content($content, $replace = '***') {\n    $inappropriate_words = ['\u4e0d\u9069\u5207\u8a9e1', '\u4e0d\u9069\u5207\u8a9e2', '\u4e0d\u9069\u5207\u8a9e3'];\n    \n    \/\/ \u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u305b\u305a\u306b\u691c\u7d22\n    foreach ($inappropriate_words as $word) {\n        \/\/ \u5358\u8a9e\u306e\u5883\u754c\u3092\u8003\u616e\u3057\u305f\u7f6e\u63db\uff08\u5358\u8a9e\u306e\u4e00\u90e8\u306b\u30de\u30c3\u30c1\u3057\u306a\u3044\u3088\u3046\uff09\n        $pattern = '\/\\b' . preg_quote($word, '\/') . '\\b\/i';\n        $content = preg_replace($pattern, $replace, $content);\n    }\n    \n    return $content;\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$comment = \"\u3053\u3093\u306b\u3061\u306f\u3001\u4e0d\u9069\u5207\u8a9e2\u306b\u3064\u3044\u3066\u8cea\u554f\u304c\u3042\u308a\u307e\u3059\u3002\";\necho filter_inappropriate_content($comment); \/\/ \"\u3053\u3093\u306b\u3061\u306f\u3001***\u306b\u3064\u3044\u3066\u8cea\u554f\u304c\u3042\u308a\u307e\u3059\u3002\"\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-66\">\u5165\u529b\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306e\u691c\u8a3c<\/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=\"\">\/\/ \u65e5\u672c\u306e\u96fb\u8a71\u756a\u53f7\u5f62\u5f0f\u3092\u691c\u8a3c\nfunction is_valid_japanese_phone($phone) {\n    \/\/ \u5165\u529b\u304b\u3089\u4f59\u5206\u306a\u6587\u5b57\u3092\u524a\u9664\n    $phone = preg_replace('\/[^\\d]\/', '', $phone);\n    \n    \/\/ \u643a\u5e2f\u96fb\u8a71\u3001\u56fa\u5b9a\u96fb\u8a71\u306e\u57fa\u672c\u30d1\u30bf\u30fc\u30f3\u78ba\u8a8d\n    if (strlen($phone) !== 10 &amp;&amp; strlen($phone) !== 11) {\n        return false;\n    }\n    \n    \/\/ \u5148\u982d\u304c0\u304b\u3089\u59cb\u307e\u308b\u304b\u78ba\u8a8d\n    if (strpos($phone, '0') !== 0) {\n        return false;\n    }\n    \n    \/\/ \u7279\u5b9a\u306e\u5e02\u5916\u5c40\u756a\u3084\u643a\u5e2f\u306e\u30d7\u30ec\u30d5\u30a3\u30c3\u30af\u30b9\u3092\u30c1\u30a7\u30c3\u30af\n    $valid_prefixes = ['090', '080', '070', '050', '03', '06', '011', '022', '045'];\n    $prefix_match = false;\n    \n    foreach ($valid_prefixes as $prefix) {\n        if (strpos($phone, $prefix) === 0) {\n            $prefix_match = true;\n            break;\n        }\n    }\n    \n    return $prefix_match;\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-67\">\u8907\u5408\u7684\u306a\u5165\u529b\u691c\u8a3c\u30af\u30e9\u30b9<\/h4>\n\n\n\n<p>\u8907\u6570\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u6301\u3064\u30d5\u30a9\u30fc\u30e0\u3067\u306f\u3001\u691c\u8a3c\u30ed\u30b8\u30c3\u30af\u3092\u30af\u30e9\u30b9\u306b\u307e\u3068\u3081\u308b\u3068\u52b9\u7387\u7684\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=\"\">class FormValidator {\n    private $errors = [];\n    \n    \/\/ \u5fc5\u9808\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u691c\u8a3c\n    public function required($field, $value, $message = '\u3053\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u306f\u5fc5\u9808\u3067\u3059') {\n        if (empty($value)) {\n            $this-&gt;errors[$field] = $message;\n            return false;\n        }\n        return true;\n    }\n    \n    \/\/ \u6700\u5c0f\u9577\u306e\u30c1\u30a7\u30c3\u30af\n    public function minLength($field, $value, $min, $message = null) {\n        if (mb_strlen($value) &lt; $min) {\n            $this-&gt;errors[$field] = $message ?? \"\u6700\u4f4e{$min}\u6587\u5b57\u5fc5\u8981\u3067\u3059\";\n            return false;\n        }\n        return true;\n    }\n    \n    \/\/ \u30d1\u30bf\u30fc\u30f3\u30c1\u30a7\u30c3\u30af\n    public function pattern($field, $value, $pattern, $message = '\u5f62\u5f0f\u304c\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093') {\n        if (!preg_match($pattern, $value)) {\n            $this-&gt;errors[$field] = $message;\n            return false;\n        }\n        return true;\n    }\n    \n    \/\/ \u7279\u5b9a\u6587\u5b57\u5217\u3092\u542b\u3080\u304b\u30c1\u30a7\u30c3\u30af\n    public function contains($field, $value, $needle, $should_contain = true, $message = null) {\n        $contains = str_contains($value, $needle);\n        if ($should_contain !== $contains) {\n            $this-&gt;errors[$field] = $message ?? ($should_contain \n                ? \"{$needle}\u3092\u542b\u3081\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\" \n                : \"{$needle}\u3092\u542b\u3081\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\");\n            return false;\n        }\n        return true;\n    }\n    \n    \/\/ \u30a8\u30e9\u30fc\u53d6\u5f97\n    public function getErrors() {\n        return $this-&gt;errors;\n    }\n    \n    \/\/ \u691c\u8a3c\u304c\u6210\u529f\u3057\u305f\u304b\u3069\u3046\u304b\n    public function isValid() {\n        return empty($this-&gt;errors);\n    }\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$validator = new FormValidator();\n$email = 'test@example.com';\n$password = 'password123';\n\n$validator-&gt;required('email', $email);\n$validator-&gt;pattern('email', $email, '\/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$\/');\n$validator-&gt;required('password', $password);\n$validator-&gt;minLength('password', $password, 8);\n$validator-&gt;contains('password', $password, '123', true);\n\nif (!$validator-&gt;isValid()) {\n    print_r($validator-&gt;getErrors());\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-68\">\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u89e3\u6790\u3067\u306e\u52b9\u7387\u7684\u306a\u6587\u5b57\u5217\u691c\u7d22<\/h3>\n\n\n\n<p>\u30b5\u30fc\u30d0\u30fc\u30ed\u30b0\u3084\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30ed\u30b0\u306e\u89e3\u6790\u306f\u3001\u6587\u5b57\u5217\u691c\u7d22\u6280\u8853\u304c\u6d3b\u8e8d\u3059\u308b\u91cd\u8981\u306a\u5206\u91ce\u3067\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-69\">\u30a8\u30e9\u30fc\u30ed\u30b0\u304b\u3089\u306e\u7279\u5b9a\u30e1\u30c3\u30bb\u30fc\u30b8\u62bd\u51fa<\/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\u30ed\u30b0\u304b\u3089\u7279\u5b9a\u306e\u7a2e\u985e\u306e\u30a8\u30e9\u30fc\u3092\u62bd\u51fa\u3059\u308b\nfunction extract_errors_from_log($log_file, $error_level = 'ERROR') {\n    $results = [];\n    $handle = fopen($log_file, 'r');\n    \n    if ($handle) {\n        while (($line = fgets($handle)) !== false) {\n            \/\/ \u30a8\u30e9\u30fc\u30ec\u30d9\u30eb\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\n            if (stripos($line, $error_level) !== false) {\n                $results[] = trim($line);\n            }\n        }\n        fclose($handle);\n    }\n    \n    return $results;\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$errors = extract_errors_from_log('\/var\/log\/application.log', 'CRITICAL');\nforeach ($errors as $error) {\n    echo $error . \"\\n\";\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-70\">\u65e5\u4ed8\u7bc4\u56f2\u3092\u6307\u5b9a\u3057\u305f\u30ed\u30b0\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=\"\">\/\/ \u7279\u5b9a\u306e\u65e5\u4ed8\u7bc4\u56f2\u306e\u30ed\u30b0\u30a8\u30f3\u30c8\u30ea\u3092\u62bd\u51fa\nfunction get_logs_by_date_range($log_file, $start_date, $end_date, $date_format = 'Y-m-d') {\n    $start_timestamp = strtotime($start_date);\n    $end_timestamp = strtotime($end_date) + 86400; \/\/ \u7d42\u4e86\u65e5\u306e\u7d42\u308f\u308a\u307e\u3067\uff08+1\u65e5\uff09\n    \n    $pattern = '\/^(\\d{4}-\\d{2}-\\d{2})\/'; \/\/ ISO\u5f62\u5f0f\u306e\u65e5\u4ed8\u3092\u60f3\u5b9a\n    $results = [];\n    \n    $handle = fopen($log_file, 'r');\n    if ($handle) {\n        while (($line = fgets($handle)) !== false) {\n            \/\/ \u884c\u304b\u3089\u65e5\u4ed8\u3092\u62bd\u51fa\n            if (preg_match($pattern, $line, $matches)) {\n                $line_date = $matches[1];\n                $line_timestamp = strtotime($line_date);\n                \n                \/\/ \u65e5\u4ed8\u7bc4\u56f2\u5185\u304b\u30c1\u30a7\u30c3\u30af\n                if ($line_timestamp &gt;= $start_timestamp &amp;&amp; $line_timestamp &lt;= $end_timestamp) {\n                    $results[] = trim($line);\n                }\n            }\n        }\n        fclose($handle);\n    }\n    \n    return $results;\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-71\">\u30ed\u30b0\u89e3\u6790\u306e\u9ad8\u5ea6\u306a\u4f8b\uff1a\u30a2\u30af\u30bb\u30b9\u30d1\u30bf\u30fc\u30f3\u306e\u5206\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=\"\">\/\/ Web\u30b5\u30fc\u30d0\u30fc\u306e\u30a2\u30af\u30bb\u30b9\u30ed\u30b0\u304b\u3089404\u30a8\u30e9\u30fc\u306eURL\u30d1\u30bf\u30fc\u30f3\u3092\u5206\u6790\nfunction analyze_404_errors($access_log) {\n    $not_found_urls = [];\n    $pattern = '\/HTTP\\\/\\d\\.\\d\"\\s404\\s\/';\n    \n    $handle = fopen($access_log, 'r');\n    if ($handle) {\n        while (($line = fgets($handle)) !== false) {\n            if (preg_match($pattern, $line)) {\n                \/\/ URL\u3092\u62bd\u51fa\uff08\u3053\u306e\u4f8b\u3067\u306f\u30b7\u30f3\u30d7\u30eb\u306a\u62bd\u51fa\u65b9\u6cd5\u3092\u4f7f\u7528\uff09\n                if (preg_match('\/\"GET ([^\"]+) HTTP\/', $line, $matches)) {\n                    $url = $matches[1];\n                    if (!isset($not_found_urls[$url])) {\n                        $not_found_urls[$url] = 0;\n                    }\n                    $not_found_urls[$url]++;\n                }\n            }\n        }\n        fclose($handle);\n    }\n    \n    \/\/ \u51fa\u73fe\u56de\u6570\u3067\u964d\u9806\u30bd\u30fc\u30c8\n    arsort($not_found_urls);\n    \n    return $not_found_urls;\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$top_404s = array_slice(analyze_404_errors('\/var\/log\/apache2\/access.log'), 0, 10);\necho \"\u6700\u3082\u591a\u3044404\u30a8\u30e9\u30fc\u306eURL:\\n\";\nforeach ($top_404s as $url =&gt; $count) {\n    echo \"$url: $count\u56de\\n\";\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-72\">\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u64cd\u4f5c\u524d\u306e\u6587\u5b57\u5217\u30d1\u30bf\u30fc\u30f3\u691c\u7d22\u3068\u51e6\u7406<\/h3>\n\n\n\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u64cd\u4f5c\u306e\u524d\u306b\u884c\u3046\u6587\u5b57\u5217\u691c\u7d22\u3068\u51e6\u7406\u306f\u3001\u30c7\u30fc\u30bf\u306e\u6574\u5408\u6027\u4fdd\u6301\u3084SQL\u30a4\u30f3\u30b8\u30a7\u30af\u30b7\u30e7\u30f3\u5bfe\u7b56\u306b\u91cd\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-73\">SQL\u30a4\u30f3\u30b8\u30a7\u30af\u30b7\u30e7\u30f3\u5bfe\u7b56<\/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=\"\">\/\/ \u30d7\u30ea\u30da\u30a2\u30c9\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3092\u4f7f\u7528\u3057\u305f\u5b89\u5168\u306a\u30af\u30a8\u30ea\u5b9f\u884c\nfunction safe_query($db, $sql, $params = []) {\n    $stmt = $db-&gt;prepare($sql);\n    \n    if ($stmt === false) {\n        return false;\n    }\n    \n    \/\/ \u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u30d0\u30a4\u30f3\u30c9\n    foreach ($params as $key =&gt; $value) {\n        $param_type = is_int($value) ? PDO::PARAM_INT : PDO::PARAM_STR;\n        $stmt-&gt;bindValue(is_int($key) ? $key + 1 : $key, $value, $param_type);\n    }\n    \n    $stmt-&gt;execute();\n    return $stmt;\n}\n\n\/\/ \u4f7f\u7528\u4f8b\uff08\u691c\u7d22\u30af\u30a8\u30ea\uff09\n$search_term = '%' . $_GET['search'] . '%'; \/\/ \u30ef\u30a4\u30eb\u30c9\u30ab\u30fc\u30c9\u4ed8\u304d\u691c\u7d22\n$stmt = safe_query($pdo, \"SELECT * FROM products WHERE name LIKE ?\", [$search_term]);\n$results = $stmt-&gt;fetchAll(PDO::FETCH_ASSOC);\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-74\">\u4e00\u62ec\u633f\u5165\u524d\u306e\u30c7\u30fc\u30bf\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=\"\">\/\/ CSV\u304b\u3089\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3078\u306e\u4e00\u62ec\u30a4\u30f3\u30dd\u30fc\u30c8\u524d\u306e\u691c\u8a3c\u3068\u51e6\u7406\nfunction prepare_csv_data_for_import($csv_file, $required_fields) {\n    $data = [];\n    $errors = [];\n    $row_num = 0;\n    \n    if (($handle = fopen($csv_file, \"r\")) !== false) {\n        \/\/ \u30d8\u30c3\u30c0\u30fc\u884c\u3092\u53d6\u5f97\n        $header = fgetcsv($handle);\n        $row_num++;\n        \n        \/\/ \u5fc5\u9808\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u30c1\u30a7\u30c3\u30af\n        foreach ($required_fields as $field) {\n            if (!in_array($field, $header)) {\n                $errors[] = \"\u5fc5\u9808\u30d5\u30a3\u30fc\u30eb\u30c9 '{$field}' \u304cCSV\u306b\u5b58\u5728\u3057\u307e\u305b\u3093\";\n                fclose($handle);\n                return ['data' =&gt; [], 'errors' =&gt; $errors];\n            }\n        }\n        \n        \/\/ \u30c7\u30fc\u30bf\u884c\u306e\u51e6\u7406\n        while (($row = fgetcsv($handle)) !== false) {\n            $row_num++;\n            $row_data = array_combine($header, $row);\n            \n            \/\/ \u30c7\u30fc\u30bf\u306e\u691c\u8a3c\u3068\u6574\u5f62\n            $valid = true;\n            \n            \/\/ \u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306e\u691c\u8a3c\u4f8b\n            if (isset($row_data['email'])) {\n                if (!filter_var($row_data['email'], FILTER_VALIDATE_EMAIL)) {\n                    $errors[] = \"\u884c {$row_num}: \u7121\u52b9\u306a\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9 '{$row_data['email']}'\";\n                    $valid = false;\n                }\n            }\n            \n            \/\/ \u96fb\u8a71\u756a\u53f7\u306e\u6574\u5f62\u4f8b\n            if (isset($row_data['phone'])) {\n                \/\/ \u6570\u5b57\u4ee5\u5916\u3092\u524a\u9664\n                $row_data['phone'] = preg_replace('\/[^\\d]\/', '', $row_data['phone']);\n                \n                \/\/ \u5f62\u5f0f\u30c1\u30a7\u30c3\u30af\n                if (!preg_match('\/^\\d{10,11}$\/', $row_data['phone'])) {\n                    $errors[] = \"\u884c {$row_num}: \u7121\u52b9\u306a\u96fb\u8a71\u756a\u53f7\u5f62\u5f0f\";\n                    $valid = false;\n                }\n            }\n            \n            if ($valid) {\n                $data[] = $row_data;\n            }\n        }\n        fclose($handle);\n    } else {\n        $errors[] = \"CSV\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u3051\u307e\u305b\u3093\u3067\u3057\u305f\";\n    }\n    \n    return [\n        'data' =&gt; $data,\n        'errors' =&gt; $errors\n    ];\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$import_result = prepare_csv_data_for_import('customers.csv', ['name', 'email', 'phone']);\n\nif (empty($import_result['errors'])) {\n    \/\/ \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u4e00\u62ec\u633f\u5165\n    $db = new PDO('mysql:host=localhost;dbname=mydb', 'username', 'password');\n    \n    foreach ($import_result['data'] as $customer) {\n        safe_query(\n            $db,\n            \"INSERT INTO customers (name, email, phone) VALUES (?, ?, ?)\",\n            [$customer['name'], $customer['email'], $customer['phone']]\n        );\n    }\n    \n    echo count($import_result['data']) . \"\u4ef6\u306e\u30c7\u30fc\u30bf\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u307e\u3057\u305f\";\n} else {\n    echo \"\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f:\\n\";\n    echo implode(\"\\n\", $import_result['errors']);\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-75\">\u691c\u7d22\u30af\u30a8\u30ea\u306e\u30d3\u30eb\u30c0\u30fc\u30d1\u30bf\u30fc\u30f3<\/h4>\n\n\n\n<p>\u8907\u96d1\u306a\u691c\u7d22\u6761\u4ef6\u3092\u6301\u3064\u30af\u30a8\u30ea\u3092\u69cb\u7bc9\u3059\u308b\u969b\u306b\u306f\u3001\u30d3\u30eb\u30c0\u30fc\u30d1\u30bf\u30fc\u30f3\u304c\u6709\u52b9\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=\"\">\/\/ \u691c\u7d22\u30af\u30a8\u30ea\u30d3\u30eb\u30c0\u30fc\u30af\u30e9\u30b9\nclass SearchQueryBuilder {\n    private $table;\n    private $conditions = [];\n    private $params = [];\n    private $order_by = '';\n    private $limit = '';\n    \n    public function __construct($table) {\n        $this-&gt;table = $table;\n    }\n    \n    \/\/ \u5b8c\u5168\u4e00\u81f4\u691c\u7d22\n    public function where($field, $value) {\n        $this-&gt;conditions[] = \"{$field} = ?\";\n        $this-&gt;params[] = $value;\n        return $this;\n    }\n    \n    \/\/ LIKE\u691c\u7d22\n    public function like($field, $value) {\n        $this-&gt;conditions[] = \"{$field} LIKE ?\";\n        $this-&gt;params[] = '%' . $value . '%';\n        return $this;\n    }\n    \n    \/\/ IN\u691c\u7d22\n    public function in($field, array $values) {\n        $placeholders = implode(',', array_fill(0, count($values), '?'));\n        $this-&gt;conditions[] = \"{$field} IN ({$placeholders})\";\n        $this-&gt;params = array_merge($this-&gt;params, $values);\n        return $this;\n    }\n    \n    \/\/ \u4e26\u3073\u9806\n    public function orderBy($field, $direction = 'ASC') {\n        $direction = strtoupper($direction) === 'DESC' ? 'DESC' : 'ASC';\n        $this-&gt;order_by = \"ORDER BY {$field} {$direction}\";\n        return $this;\n    }\n    \n    \/\/ \u4ef6\u6570\u5236\u9650\n    public function limit($count, $offset = 0) {\n        $this-&gt;limit = \"LIMIT {$offset}, {$count}\";\n        return $this;\n    }\n    \n    \/\/ SQL\u751f\u6210\n    public function buildQuery() {\n        $sql = \"SELECT * FROM {$this-&gt;table}\";\n        \n        if (!empty($this-&gt;conditions)) {\n            $sql .= \" WHERE \" . implode(' AND ', $this-&gt;conditions);\n        }\n        \n        if (!empty($this-&gt;order_by)) {\n            $sql .= \" {$this-&gt;order_by}\";\n        }\n        \n        if (!empty($this-&gt;limit)) {\n            $sql .= \" {$this-&gt;limit}\";\n        }\n        \n        return $sql;\n    }\n    \n    \/\/ \u30af\u30a8\u30ea\u5b9f\u884c\n    public function execute($db) {\n        $sql = $this-&gt;buildQuery();\n        $stmt = $db-&gt;prepare($sql);\n        \n        foreach ($this-&gt;params as $index =&gt; $value) {\n            $stmt-&gt;bindValue($index + 1, $value);\n        }\n        \n        $stmt-&gt;execute();\n        return $stmt-&gt;fetchAll(PDO::FETCH_ASSOC);\n    }\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$db = new PDO('mysql:host=localhost;dbname=mydb', 'username', 'password');\n\n$results = (new SearchQueryBuilder('products'))\n    -&gt;where('category_id', 5)\n    -&gt;like('name', 'PHP')\n    -&gt;orderBy('price', 'DESC')\n    -&gt;limit(10)\n    -&gt;execute($db);\n\nforeach ($results as $product) {\n    echo \"{$product['name']}: {$product['price']}\u5186\\n\";\n}\n<\/pre>\n\n\n\n<p>\u5b9f\u8df5\u7684\u306a\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u3067\u306e\u6587\u5b57\u5217\u691c\u7d22\u5b9f\u88c5\u3092\u7406\u89e3\u3059\u308b\u3053\u3068\u3067\u3001PHP\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u54c1\u8cea\u3068\u5b89\u5168\u6027\u3092\u9ad8\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u6587\u5b57\u5217\u691c\u7d22\u306b\u304a\u3051\u308b\u4e00\u822c\u7684\u306a\u554f\u984c\u3068\u305d\u306e\u89e3\u6c7a\u7b56\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-76\">\u6587\u5b57\u5217\u691c\u7d22\u306b\u304a\u3051\u308b\u4e00\u822c\u7684\u306a\u554f\u984c\u3068\u305d\u306e\u89e3\u6c7a\u7b56<\/h2>\n\n\n\n<p>PHP\u3067\u306e\u6587\u5b57\u5217\u691c\u7d22\u3092\u5b9f\u88c5\u3059\u308b\u969b\u3001\u3044\u304f\u3064\u304b\u306e\u4e00\u822c\u7684\u306a\u554f\u984c\u306b\u76f4\u9762\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u305d\u3046\u3057\u305f\u554f\u984c\u3092\u89e3\u6c7a\u3059\u308b\u305f\u3081\u306e\u5b9f\u8df5\u7684\u306a\u30a2\u30d7\u30ed\u30fc\u30c1\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-77\">\u65e5\u672c\u8a9e\u306a\u3069\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3067\u306e\u691c\u7d22\u6642\u306e\u6ce8\u610f\u70b9<\/h3>\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\u6271\u3046\u5834\u5408\u3001\u6a19\u6e96\u306e\u6587\u5b57\u5217\u95a2\u6570\u3067\u306f\u6b63\u78ba\u306b\u51e6\u7406\u3067\u304d\u306a\u3044\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-78\">\u554f\u984c1: \u6587\u5b57\u6570\u306e\u30ab\u30a6\u30f3\u30c8<\/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=\"\">$text = \"\u3053\u3093\u306b\u3061\u306f\u4e16\u754c\"; \/\/ \u65e5\u672c\u8a9e\n\n\/\/ \u8aa4\u3063\u305f\u6587\u5b57\u6570\u30ab\u30a6\u30f3\u30c8\necho strlen($text); \/\/ \u51fa\u529b: 21 (UTF-8\u3067\u306f\u5404\u65e5\u672c\u8a9e\u6587\u5b57\u304c3\u30d0\u30a4\u30c8\u3092\u5360\u3081\u308b\u305f\u3081)\n\n\/\/ \u6b63\u3057\u3044\u6587\u5b57\u6570\u30ab\u30a6\u30f3\u30c8\necho mb_strlen($text); \/\/ \u51fa\u529b: 7\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-79\">\u554f\u984c2: \u90e8\u5206\u6587\u5b57\u5217\u306e\u62bd\u51fa<\/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=\"\">$text = \"PHP\u3067\u65e5\u672c\u8a9e\u3092\u51e6\u7406\u3059\u308b\";\n\n\/\/ \u8aa4\u3063\u305f\u90e8\u5206\u6587\u5b57\u5217\u62bd\u51fa\uff08\u30d0\u30a4\u30c8\u5358\u4f4d\u3067\u51e6\u7406\u3057\u3066\u3057\u307e\u3046\uff09\necho substr($text, 0, 9); \/\/ \u51fa\u529b: \"PHP\u3067\u65e5\" (\u4e0d\u5b8c\u5168\u306a\u65e5\u672c\u8a9e\u6587\u5b57\u304c\u542b\u307e\u308c\u308b)\n\n\/\/ \u6b63\u3057\u3044\u90e8\u5206\u6587\u5b57\u5217\u62bd\u51fa\necho mb_substr($text, 0, 5); \/\/ \u51fa\u529b: \"PHP\u3067\u65e5\u672c\"\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-80\">\u554f\u984c3: \u6587\u5b57\u4f4d\u7f6e\u306e\u691c\u7d22<\/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=\"\">$text = \"PHP\u3067\u65e5\u672c\u8a9e\u3092\u51e6\u7406\u3059\u308b\";\n$search = \"\u65e5\u672c\u8a9e\";\n\n\/\/ \u8aa4\u3063\u305f\u4f4d\u7f6e\u691c\u7d22\n$pos = strpos($text, $search);\necho $pos; \/\/ \u51fa\u529b: 6 (\u30d0\u30a4\u30c8\u4f4d\u7f6e)\n\n\/\/ \u6b63\u3057\u3044\u6587\u5b57\u4f4d\u7f6e\u691c\u7d22\n$pos = mb_strpos($text, $search);\necho $pos; \/\/ \u51fa\u529b: 3 (\u6587\u5b57\u4f4d\u7f6e)\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-81\">\u89e3\u6c7a\u7b56: \u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u5bfe\u5fdc\u306e\u4e00\u8cab\u3057\u305f\u4f7f\u7528<\/h4>\n\n\n\n<p>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u6271\u3046\u5834\u5408\u306f\u3001\u5e38\u306b<code>mb_*<\/code>\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002\u307e\u305f\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u5168\u4f53\u3067\u4e00\u8cab\u3057\u305f\u6587\u5b57\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3082\u30dd\u30a4\u30f3\u30c8\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=\"\">\/\/ \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u5168\u4f53\u3067\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u8a2d\u5b9a\nmb_internal_encoding('UTF-8');\nmb_http_output('UTF-8');\n\n\/\/ \u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u6271\u3046\u4fbf\u5229\u306a\u95a2\u6570\nfunction mb_find_all_positions($haystack, $needle) {\n    $positions = [];\n    $pos = 0;\n    \n    while (($pos = mb_strpos($haystack, $needle, $pos)) !== false) {\n        $positions[] = $pos;\n        $pos = $pos + mb_strlen($needle);\n    }\n    \n    return $positions;\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$text = \"\u65e5\u672c\u8a9e\u3067\u66f8\u304b\u308c\u305f\u65e5\u672c\u8a9e\u306e\u6587\u7ae0\u3092\u65e5\u672c\u8a9e\u3067\u691c\u7d22\";\n$search = \"\u65e5\u672c\u8a9e\";\n$positions = mb_find_all_positions($text, $search);\nprint_r($positions); \/\/ [0, 6, 15] - \u300c\u65e5\u672c\u8a9e\u300d\u304c\u51fa\u73fe\u3059\u308b\u6587\u5b57\u4f4d\u7f6e\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-82\">\u6587\u5b57\u30b3\u30fc\u30c9\u5909\u63db\u306e\u6ce8\u610f\u70b9<\/h4>\n\n\n\n<p>\u7570\u306a\u308b\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u306e\u30c7\u30fc\u30bf\u3092\u6271\u3046\u5834\u5408\u306f\u3001\u51e6\u7406\u524d\u306b\u7d71\u4e00\u3059\u308b\u3053\u3068\u304c\u91cd\u8981\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=\"\">\/\/ \u6587\u5b57\u30b3\u30fc\u30c9\u5909\u63db\u306e\u5b89\u5168\u306a\u5b9f\u88c5\nfunction safe_encoding_convert($text, $to_encoding = 'UTF-8', $from_encoding = 'auto') {\n    \/\/ \u81ea\u52d5\u691c\u51fa\u3092\u8a66\u307f\u308b\n    if ($from_encoding === 'auto') {\n        $detected = mb_detect_encoding($text, ['UTF-8', 'SJIS', 'EUC-JP', 'ISO-2022-JP'], true);\n        $from_encoding = $detected ?: 'UTF-8';\n    }\n    \n    \/\/ \u65e2\u306b\u76ee\u7684\u306e\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u306e\u5834\u5408\u306f\u305d\u306e\u307e\u307e\u8fd4\u3059\n    if ($from_encoding === $to_encoding) {\n        return $text;\n    }\n    \n    \/\/ \u5909\u63db\u3092\u5b9f\u884c\n    $converted = mb_convert_encoding($text, $to_encoding, $from_encoding);\n    \n    \/\/ \u5909\u63db\u30a8\u30e9\u30fc\u3092\u30c1\u30a7\u30c3\u30af\uff08\u4e0d\u6b63\u306a\u6587\u5b57\u5217\u306b\u306a\u3063\u305f\u5834\u5408\uff09\n    if ($converted === '' &amp;&amp; $text !== '') {\n        throw new Exception('\u6587\u5b57\u30b3\u30fc\u30c9\u5909\u63db\u306b\u5931\u6557\u3057\u307e\u3057\u305f');\n    }\n    \n    return $converted;\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-83\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30dc\u30c8\u30eb\u30cd\u30c3\u30af\u306e\u7279\u5b9a\u3068\u89e3\u6d88\u6cd5<\/h3>\n\n\n\n<p>\u6587\u5b57\u5217\u691c\u7d22\u304c\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30dc\u30c8\u30eb\u30cd\u30c3\u30af\u306b\u306a\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u306b\u4e00\u822c\u7684\u306a\u554f\u984c\u3068\u89e3\u6c7a\u7b56\u3092\u793a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-84\">\u554f\u984c1: \u4e0d\u9069\u5207\u306a\u95a2\u6570\u9078\u629e<\/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=\"\">\/\/ \u975e\u52b9\u7387\u306a\u5b9f\u88c5\uff081\u4e07\u884c\u306e\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u7279\u5b9a\u306e\u6587\u5b57\u5217\u3092\u691c\u7d22\uff09\nfunction find_in_log_inefficient($log_file, $search_term) {\n    $content = file_get_contents($log_file); \/\/ \u30d5\u30a1\u30a4\u30eb\u5168\u4f53\u3092\u30e1\u30e2\u30ea\u306b\u8aad\u307f\u8fbc\u3080\n    return strpos($content, $search_term) !== false;\n}\n\n\/\/ \u52b9\u7387\u7684\u306a\u5b9f\u88c5\nfunction find_in_log_efficient($log_file, $search_term) {\n    $handle = fopen($log_file, 'r');\n    $found = false;\n    \n    if ($handle) {\n        while (!$found &amp;&amp; ($line = fgets($handle)) !== false) {\n            if (strpos($line, $search_term) !== false) {\n                $found = true;\n            }\n        }\n        fclose($handle);\n    }\n    \n    return $found;\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-85\">\u554f\u984c2: \u4e0d\u8981\u306a\u7e70\u308a\u8fd4\u3057\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=\"\">\/\/ \u975e\u52b9\u7387\u306a\u30b3\u30fc\u30c9\uff08\u540c\u3058\u6b63\u898f\u8868\u73fe\u3092\u4f55\u5ea6\u3082\u518d\u30b3\u30f3\u30d1\u30a4\u30eb\uff09\nfunction extract_emails_inefficient($texts) {\n    $pattern = '\/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}\/';\n    $emails = [];\n    \n    foreach ($texts as $text) {\n        preg_match_all($pattern, $text, $matches);\n        $emails = array_merge($emails, $matches[0]);\n    }\n    \n    return $emails;\n}\n\n\/\/ \u52b9\u7387\u7684\u306a\u30b3\u30fc\u30c9\uff08\u6b63\u898f\u8868\u73fe\u3092\u4e00\u5ea6\u3060\u3051\u30b3\u30f3\u30d1\u30a4\u30eb\uff09\nfunction extract_emails_efficient($texts) {\n    $pattern = '\/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}\/';\n    $emails = [];\n    $combined_text = implode(\"\\n\", $texts);\n    \n    preg_match_all($pattern, $combined_text, $matches);\n    return $matches[0];\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-86\">\u554f\u984c3: \u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u306e\u5897\u52a0<\/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=\"\">\/\/ \u30e1\u30e2\u30ea\u52b9\u7387\u306e\u60aa\u3044\u5b9f\u88c5\uff08\u5927\u91cf\u306e\u7f6e\u63db\u64cd\u4f5c\uff09\nfunction redact_sensitive_data_inefficient($text, $patterns) {\n    foreach ($patterns as $pattern) {\n        $text = str_replace($pattern, '***', $text);\n    }\n    return $text;\n}\n\n\/\/ \u30e1\u30e2\u30ea\u52b9\u7387\u306e\u826f\u3044\u5b9f\u88c5\uff08\u53c2\u7167\u6e21\u3057\u3068\u4e00\u62ec\u7f6e\u63db\uff09\nfunction redact_sensitive_data_efficient($text, $patterns) {\n    return str_replace($patterns, array_fill(0, count($patterns), '***'), $text);\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-87\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u8a08\u6e2c\u3068\u30dc\u30c8\u30eb\u30cd\u30c3\u30af\u7279\u5b9a<\/h4>\n\n\n\n<p>\u6587\u5b57\u5217\u51e6\u7406\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30dc\u30c8\u30eb\u30cd\u30c3\u30af\u3092\u7279\u5b9a\u3059\u308b\u306b\u306f\u3001\u30b3\u30fc\u30c9\u306e\u5b9f\u884c\u6642\u9593\u3068\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3092\u8a08\u6e2c\u3059\u308b\u3053\u3068\u304c\u91cd\u8981\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=\"\">\/\/ \u51e6\u7406\u6642\u9593\u3068\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3092\u8a08\u6e2c\u3059\u308b\u95a2\u6570\nfunction benchmark_function($callback, $params = []) {\n    \/\/ \u521d\u671f\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3092\u8a18\u9332\n    $start_memory = memory_get_usage();\n    \n    \/\/ \u958b\u59cb\u6642\u9593\u3092\u8a18\u9332\n    $start_time = microtime(true);\n    \n    \/\/ \u95a2\u6570\u5b9f\u884c\n    $result = $callback(...$params);\n    \n    \/\/ \u5b9f\u884c\u6642\u9593\u3092\u8a08\u7b97\n    $execution_time = microtime(true) - $start_time;\n    \n    \/\/ \u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3092\u8a08\u7b97\n    $memory_usage = memory_get_usage() - $start_memory;\n    \n    return [\n        'result' =&gt; $result,\n        'execution_time' =&gt; $execution_time,\n        'memory_usage' =&gt; $memory_usage\n    ];\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$text = file_get_contents('large_log.txt');\n$needle = 'ERROR';\n\n$inefficient = benchmark_function('strstr', [$text, $needle]);\necho \"\u975e\u52b9\u7387\u306a\u65b9\u6cd5: {$inefficient['execution_time']}\u79d2, {$inefficient['memory_usage']}\u30d0\u30a4\u30c8\\n\";\n\n$efficient = benchmark_function(function($text, $needle) {\n    return strpos($text, $needle) !== false;\n}, [$text, $needle]);\necho \"\u52b9\u7387\u7684\u306a\u65b9\u6cd5: {$efficient['execution_time']}\u79d2, {$efficient['memory_usage']}\u30d0\u30a4\u30c8\\n\";\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-88\">\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30ea\u30b9\u30af\u3092\u8003\u616e\u3057\u305f\u6587\u5b57\u5217\u691c\u7d22\u5b9f\u88c5<\/h3>\n\n\n\n<p>\u6587\u5b57\u5217\u691c\u7d22\u3068\u51e6\u7406\u306b\u306f\u3001\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30ea\u30b9\u30af\u304c\u4f34\u3046\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u306b\u4e00\u822c\u7684\u306a\u30ea\u30b9\u30af\u3068\u305d\u306e\u5bfe\u7b56\u3092\u793a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-89\">\u554f\u984c1: \u30af\u30ed\u30b9\u30b5\u30a4\u30c8\u30b9\u30af\u30ea\u30d7\u30c6\u30a3\u30f3\u30b0\uff08XSS\uff09<\/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=\"\">\/\/ \u5371\u967a\u306a\u5b9f\u88c5\uff08\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u3092\u305d\u306e\u307e\u307e\u51fa\u529b\uff09\nfunction search_and_highlight_unsafe($text, $search) {\n    return str_replace($search, '&lt;span class=\"highlight\"&gt;' . $search . '&lt;\/span&gt;', $text);\n}\n\n\/\/ \u5b89\u5168\u306a\u5b9f\u88c5\uff08\u30a8\u30b9\u30b1\u30fc\u30d7\u51e6\u7406\uff09\nfunction search_and_highlight_safe($text, $search) {\n    \/\/ \u307e\u305a\u4e21\u65b9\u3092\u30a8\u30b9\u30b1\u30fc\u30d7\n    $text_safe = htmlspecialchars($text, ENT_QUOTES, 'UTF-8');\n    $search_safe = htmlspecialchars($search, ENT_QUOTES, 'UTF-8');\n    \n    \/\/ \u30a8\u30b9\u30b1\u30fc\u30d7\u6e08\u307f\u306e\u6587\u5b57\u5217\u3067\u7f6e\u63db\n    return str_replace($search_safe, '&lt;span class=\"highlight\"&gt;' . $search_safe . '&lt;\/span&gt;', $text_safe);\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-90\">\u554f\u984c2: \u30b3\u30de\u30f3\u30c9\u30a4\u30f3\u30b8\u30a7\u30af\u30b7\u30e7\u30f3<\/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=\"\">\/\/ \u5371\u967a\u306a\u5b9f\u88c5\uff08\u30b7\u30a7\u30eb\u30b3\u30de\u30f3\u30c9\u306b\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u3092\u76f4\u63a5\u4f7f\u7528\uff09\nfunction grep_logs_unsafe($search_term) {\n    $command = 'grep \"' . $search_term . '\" \/var\/log\/application.log';\n    return shell_exec($command);\n}\n\n\/\/ \u5b89\u5168\u306a\u5b9f\u88c5\uff08\u30a8\u30b9\u30b1\u30fc\u30d7\u51e6\u7406\uff09\nfunction grep_logs_safe($search_term) {\n    $search_term = escapeshellarg($search_term);\n    $command = 'grep ' . $search_term . ' \/var\/log\/application.log';\n    return shell_exec($command);\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-91\">\u554f\u984c3: \u6b63\u898f\u8868\u73fe\u306e\u8106\u5f31\u6027\uff08ReDoS\uff09<\/h4>\n\n\n\n<p>\u7279\u5b9a\u306e\u6b63\u898f\u8868\u73fe\u30d1\u30bf\u30fc\u30f3\u306f\u3001\u60aa\u610f\u3042\u308b\u5165\u529b\u306b\u3088\u3063\u3066\u51e6\u7406\u6642\u9593\u304c\u6307\u6570\u95a2\u6570\u7684\u306b\u5897\u52a0\u3059\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\uff08\u6b63\u898f\u8868\u73feDoS\u653b\u6483\uff09\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=\"\">\/\/ \u5371\u967a\u306a\u6b63\u898f\u8868\u73fe\u30d1\u30bf\u30fc\u30f3\uff08\u30d0\u30c3\u30af\u30c8\u30e9\u30c3\u30af\u304c\u591a\u767a\u3059\u308b\u53ef\u80fd\u6027\uff09\n$unsafe_pattern = '\/^(a+)+$\/';\n\n\/\/ \u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u5bfe\u7b56\u3092\u5b9f\u88c5\nfunction safe_regex_match($pattern, $subject, $timeout = 1) {\n    \/\/ \u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u8a2d\u5b9a\uff08\u79d2\uff09\n    $previous_timeout = ini_get('max_execution_time');\n    set_time_limit($timeout);\n    \n    try {\n        $result = preg_match($pattern, $subject);\n        \n        \/\/ \u5143\u306e\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u8a2d\u5b9a\u306b\u623b\u3059\n        set_time_limit($previous_timeout);\n        \n        return $result;\n    } catch (Exception $e) {\n        \/\/ \u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u307e\u305f\u306f\u305d\u306e\u4ed6\u306e\u30a8\u30e9\u30fc\n        set_time_limit($previous_timeout);\n        return false;\n    }\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-92\">\u5b89\u5168\u306a\u6587\u5b57\u5217\u691c\u7d22\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u5e38\u306b\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u3092\u30b5\u30cb\u30bf\u30a4\u30ba\u3059\u308b<\/strong> <code>$search_term = htmlspecialchars($user_input, ENT_QUOTES, 'UTF-8');<\/code><\/li>\n\n\n\n<li><strong>\u9069\u5207\u306a\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u3067\u306e\u30a8\u30b9\u30b1\u30fc\u30d7<\/strong> <code>\/\/ HTML\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8 $html_safe = htmlspecialchars($input, ENT_QUOTES, 'UTF-8'); \/\/ URL $url_safe = urlencode($input); \/\/ SQL $sql_safe = $pdo-&gt;quote($input); \/\/ \u30b7\u30a7\u30eb\u30b3\u30de\u30f3\u30c9 $shell_safe = escapeshellarg($input);<\/code><\/li>\n\n\n\n<li><strong>\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u8a2d\u5b9a<\/strong> <code>\/\/ \u51e6\u7406\u306b\u6642\u9593\u5236\u9650\u3092\u8a2d\u3051\u308b set_time_limit(5); \/\/ 5\u79d2 \/\/ \u307e\u305f\u306f\u7279\u5b9a\u306e\u51e6\u7406\u3060\u3051\u3092\u5236\u9650 $context = stream_context_create([ 'http' =&gt; ['timeout' =&gt; 3] \/\/ 3\u79d2 ]); $content = file_get_contents($url, false, $context);<\/code><\/li>\n\n\n\n<li><strong>\u30e1\u30e2\u30ea\u5236\u9650\u306e\u8a2d\u5b9a<\/strong> <code>\/\/ \u30b9\u30af\u30ea\u30d7\u30c8\u306e\u30e1\u30e2\u30ea\u5236\u9650\u3092\u8a2d\u5b9a ini_set('memory_limit', '128M');<\/code><\/li>\n<\/ol>\n\n\n\n<p>\u9069\u5207\u306a\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5bfe\u7b56\u3092\u65bd\u3057\u305f\u6587\u5b57\u5217\u691c\u7d22\u5b9f\u88c5\u306b\u3088\u308a\u3001\u591a\u304f\u306e\u6f5c\u5728\u7684\u306a\u8106\u5f31\u6027\u3092\u9632\u3050\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001PHP\u306e\u65b0\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u304a\u3051\u308b\u6587\u5b57\u5217\u691c\u7d22\u6a5f\u80fd\u306e\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-93\">PHP\u306e\u65b0\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u304a\u3051\u308b\u6587\u5b57\u5217\u691c\u7d22\u6a5f\u80fd\u306e\u9032\u5316<\/h2>\n\n\n\n<p>PHP\u306e\u9032\u5316\u306b\u4f34\u3044\u3001\u6587\u5b57\u5217\u691c\u7d22\u3068\u64cd\u4f5c\u306e\u6a5f\u80fd\u3082\u5927\u304d\u304f\u6539\u5584\u3055\u308c\u3066\u304d\u307e\u3057\u305f\u3002\u7279\u306bPHP 7.x\u304b\u3089PHP 8.x\u3078\u306e\u79fb\u884c\u3067\u306f\u3001\u958b\u767a\u8005\u306e\u751f\u7523\u6027\u3092\u9ad8\u3081\u308b\u305f\u3081\u306e\u591a\u304f\u306e\u65b0\u6a5f\u80fd\u304c\u5c0e\u5165\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u6700\u65b0\u306ePHP\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u5229\u7528\u3067\u304d\u308b\u6587\u5b57\u5217\u691c\u7d22\u6a5f\u80fd\u306e\u9032\u5316\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-94\">PHP 7.x\u304b\u30898.x\u3078\u306e\u6587\u5b57\u5217\u64cd\u4f5c\u306e\u6539\u5584\u70b9<\/h3>\n\n\n\n<p>PHP 8.0\u306f\u6587\u5b57\u5217\u64cd\u4f5c\u306b\u304a\u3044\u3066\u5927\u304d\u306a\u9032\u5316\u3092\u9042\u3052\u307e\u3057\u305f\u3002\u305d\u308c\u307e\u3067\u306e\u8907\u96d1\u306a\u66f8\u304d\u65b9\u3084\u56de\u907f\u7b56\u304c\u4e0d\u8981\u306b\u306a\u308a\u3001\u3088\u308a\u30b7\u30f3\u30d7\u30eb\u3067\u76f4\u611f\u7684\u306a\u30b3\u30fc\u30c9\u304c\u66f8\u3051\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-95\">\u4e3b\u306a\u6539\u5584\u70b9<\/h4>\n\n\n<div id=\"id-379bd31f-ecff-41af-bb8a-10c152eea8d0\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u6a5f\u80fd<\/th><th>PHP 7.x \u3067\u306e\u5b9f\u88c5<\/th><th>PHP 8.x \u3067\u306e\u5b9f\u88c5<\/th><\/tr><\/thead><tbody><tr><td>\u6587\u5b57\u5217\u306e\u5305\u542b\u30c1\u30a7\u30c3\u30af<\/td><td><code>strpos($str, $needle) !== false<\/code><\/td><td><code>str_contains($str, $needle)<\/code><\/td><\/tr><tr><td>\u524d\u65b9\u4e00\u81f4\u30c1\u30a7\u30c3\u30af<\/td><td><code>strpos($str, $needle) === 0<\/code><\/td><td><code>str_starts_with($str, $needle)<\/code><\/td><\/tr><tr><td>\u5f8c\u65b9\u4e00\u81f4\u30c1\u30a7\u30c3\u30af<\/td><td><code>substr($str, -strlen($needle)) === $needle<\/code><\/td><td><code>str_ends_with($str, $needle)<\/code><\/td><\/tr><tr><td>\u540d\u524d\u4ed8\u304d\u30ad\u30e3\u30d7\u30c1\u30e3\u30b0\u30eb\u30fc\u30d7<\/td><td>\u8907\u96d1\u306a\u53d6\u308a\u51fa\u3057\u65b9\u6cd5<\/td><td>\u3088\u308a\u7c21\u5358\u306a\u30a2\u30af\u30bb\u30b9\u65b9\u6cd5<\/td><\/tr><tr><td>JIT\u30b3\u30f3\u30d1\u30a4\u30e9<\/td><td>\u306a\u3057<\/td><td>\u6587\u5b57\u5217\u64cd\u4f5c\u3092\u542b\u3080\u51e6\u7406\u306e\u9ad8\u901f\u5316<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<h4 class=\"wp-block-heading\" id=\"i-96\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306e\u6539\u5584<\/h4>\n\n\n\n<p>PHP 8.0\u4ee5\u964d\u3067\u306f\u3001\u5185\u90e8\u5b9f\u88c5\u306e\u6700\u9069\u5316\u306b\u3088\u308a\u6587\u5b57\u5217\u64cd\u4f5c\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3082\u5411\u4e0a\u3057\u3066\u3044\u307e\u3059\u3002\u7279\u306bJIT\u30b3\u30f3\u30d1\u30a4\u30e9\u306e\u5c0e\u5165\u306f\u3001\u30eb\u30fc\u30d7\u5185\u3067\u306e\u6587\u5b57\u5217\u51e6\u7406\u306a\u3069\u3067\u5927\u304d\u306a\u52b9\u679c\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=\"\">\/\/ \u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6bd4\u8f03\u4f8b\n$text = str_repeat(\"PHP\u306e\u6587\u5b57\u5217\u51e6\u7406\u306e\u9032\u5316\", 100000);\n$search = \"\u9032\u5316\";\n\n\/\/ PHP 7.x \u30b9\u30bf\u30a4\u30eb\n$start = microtime(true);\n$result = strpos($text, $search) !== false;\n$php7_time = microtime(true) - $start;\n\n\/\/ PHP 8.x \u30b9\u30bf\u30a4\u30eb\uff08PHP 8.0\u4ee5\u4e0a\u3067\u5b9f\u884c\u53ef\u80fd\uff09\n$start = microtime(true);\n$result = str_contains($text, $search);\n$php8_time = microtime(true) - $start;\n\necho \"PHP 7.x style: \" . $php7_time . \"\u79d2\\n\";\necho \"PHP 8.x style: \" . $php8_time . \"\u79d2\\n\";\necho \"\u901f\u5ea6\u5411\u4e0a\u6bd4\u7387: \" . ($php7_time \/ $php8_time) . \"\u500d\\n\";\n<\/pre>\n\n\n\n<p>\u5b9f\u969b\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306f\u74b0\u5883\u306b\u3088\u3063\u3066\u7570\u306a\u308a\u307e\u3059\u304c\u3001\u4e00\u822c\u7684\u306b<code>str_contains()<\/code>\u306f\u6700\u9069\u5316\u3055\u308c\u305f\u5b9f\u88c5\u306b\u3088\u308a\u3001\u5f93\u6765\u306e<code>strpos()<\/code>\u3088\u308a\u3082\u82e5\u5e72\u9ad8\u901f\u306b\u52d5\u4f5c\u3059\u308b\u50be\u5411\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-97\">PHP 8.0\u3067\u8ffd\u52a0\u3055\u308c\u305fstr_contains()\u3001str_starts_with()\u3001str_ends_with()<\/h3>\n\n\n\n<p>PHP 8.0\u3067\u5c0e\u5165\u3055\u308c\u305f3\u3064\u306e\u65b0\u3057\u3044\u6587\u5b57\u5217\u95a2\u6570\u306f\u3001\u958b\u767a\u8005\u306e\u65e5\u5e38\u7684\u306a\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u5927\u5e45\u306b\u6539\u5584\u3057\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u95a2\u6570\u306f\u30b7\u30f3\u30d7\u30eb\u3067\u308f\u304b\u308a\u3084\u3059\u304f\u3001\u30b3\u30fc\u30c9\u306e\u53ef\u8aad\u6027\u3092\u9ad8\u3081\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-98\">str_contains() \u2013 \u6587\u5b57\u5217\u304c\u5225\u306e\u6587\u5b57\u5217\u3092\u542b\u3080\u304b\u3092\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=\"\">\/\/ str_contains(\u691c\u7d22\u5bfe\u8c61\u6587\u5b57\u5217, \u63a2\u3059\u6587\u5b57\u5217): bool\n$text = \"PHP\u306e\u6587\u5b57\u5217\u691c\u7d22\u6a5f\u80fd\";\n\n\/\/ PHP 8.0\u4ee5\u964d\nif (str_contains($text, \"\u6587\u5b57\u5217\")) {\n    echo \"\u300c\u6587\u5b57\u5217\u300d\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\"; \/\/ \u51fa\u529b\u3055\u308c\u308b\n}\n\n\/\/ PHP 7.x\u3067\u306e\u540c\u7b49\u30b3\u30fc\u30c9\nif (strpos($text, \"\u6587\u5b57\u5217\") !== false) {\n    echo \"\u300c\u6587\u5b57\u5217\u300d\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\";\n}\n<\/pre>\n\n\n\n<p><code>str_contains()<\/code>\u306e\u30e1\u30ea\u30c3\u30c8:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u53ef\u8aad\u6027\u304c\u9ad8\u3044\uff08\u610f\u56f3\u304c\u660e\u78ba\uff09<\/li>\n\n\n\n<li>\u4f4d\u7f6e0\u3067\u691c\u51fa\u3059\u308b\u969b\u306e<code>!== false<\/code>\u306e\u56de\u907f\u7b56\u304c\u4e0d\u8981<\/li>\n\n\n\n<li>\u5185\u90e8\u3067\u6700\u9069\u5316\u3055\u308c\u3066\u3044\u308b<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-99\">str_starts_with() \u2013 \u6587\u5b57\u5217\u304c\u7279\u5b9a\u306e\u30d7\u30ec\u30d5\u30a3\u30c3\u30af\u30b9\u3067\u59cb\u307e\u308b\u304b\u3092\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=\"\">\/\/ str_starts_with(\u691c\u7d22\u5bfe\u8c61\u6587\u5b57\u5217, \u524d\u65b9\u4e00\u81f4\u3059\u308b\u6587\u5b57\u5217): bool\n$text = \"PHP\u306e\u6587\u5b57\u5217\u691c\u7d22\u6a5f\u80fd\";\n\n\/\/ PHP 8.0\u4ee5\u964d\nif (str_starts_with($text, \"PHP\")) {\n    echo \"\u300cPHP\u300d\u3067\u59cb\u307e\u3063\u3066\u3044\u307e\u3059\"; \/\/ \u51fa\u529b\u3055\u308c\u308b\n}\n\n\/\/ PHP 7.x\u3067\u306e\u540c\u7b49\u30b3\u30fc\u30c9\nif (strpos($text, \"PHP\") === 0) {\n    echo \"\u300cPHP\u300d\u3067\u59cb\u307e\u3063\u3066\u3044\u307e\u3059\";\n}\n<\/pre>\n\n\n\n<p><code>str_starts_with()<\/code>\u306e\u30e1\u30ea\u30c3\u30c8:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u76f4\u611f\u7684\u306aAPI<\/li>\n\n\n\n<li>\u30b3\u30fc\u30c9\u306e\u610f\u56f3\u304c\u660e\u78ba<\/li>\n\n\n\n<li>\u77ed\u3044\u30d7\u30ec\u30d5\u30a3\u30c3\u30af\u30b9\u3084\u7a7a\u6587\u5b57\u5217\u306e\u51e6\u7406\u306b\u6700\u9069\u5316\u3055\u308c\u3066\u3044\u308b<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-100\">str_ends_with() \u2013 \u6587\u5b57\u5217\u304c\u7279\u5b9a\u306e\u30b5\u30d5\u30a3\u30c3\u30af\u30b9\u3067\u7d42\u308f\u308b\u304b\u3092\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=\"\">\/\/ str_ends_with(\u691c\u7d22\u5bfe\u8c61\u6587\u5b57\u5217, \u5f8c\u65b9\u4e00\u81f4\u3059\u308b\u6587\u5b57\u5217): bool\n$text = \"PHP\u306e\u6587\u5b57\u5217\u691c\u7d22\u6a5f\u80fd\";\n\n\/\/ PHP 8.0\u4ee5\u964d\nif (str_ends_with($text, \"\u6a5f\u80fd\")) {\n    echo \"\u300c\u6a5f\u80fd\u300d\u3067\u7d42\u308f\u3063\u3066\u3044\u307e\u3059\"; \/\/ \u51fa\u529b\u3055\u308c\u308b\n}\n\n\/\/ PHP 7.x\u3067\u306e\u540c\u7b49\u30b3\u30fc\u30c9\nif (substr($text, -strlen(\"\u6a5f\u80fd\")) === \"\u6a5f\u80fd\") {\n    echo \"\u300c\u6a5f\u80fd\u300d\u3067\u7d42\u308f\u3063\u3066\u3044\u307e\u3059\";\n}\n<\/pre>\n\n\n\n<p><code>str_ends_with()<\/code>\u306e\u30e1\u30ea\u30c3\u30c8:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u8907\u96d1\u306a\u8a08\u7b97\u304c\u4e0d\u8981<\/li>\n\n\n\n<li>\u30b3\u30fc\u30c9\u304c\u8aad\u307f\u3084\u3059\u304f\u3001\u30a8\u30e9\u30fc\u304c\u5c11\u306a\u3044<\/li>\n\n\n\n<li>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316\u3055\u308c\u3066\u3044\u308b<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-101\">\u5b9f\u7528\u7684\u306a\u4f7f\u7528\u4f8b<\/h4>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u65b0\u6a5f\u80fd\u3092\u4f7f\u3063\u305f\u5b9f\u7528\u7684\u306a\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=\"\">\/\/ \u30d5\u30a1\u30a4\u30eb\u62e1\u5f35\u5b50\u306e\u30c1\u30a7\u30c3\u30af\nfunction is_image_file($filename) {\n    $image_extensions = ['.jpg', '.jpeg', '.png', '.gif', '.webp'];\n    \n    foreach ($image_extensions as $ext) {\n        if (str_ends_with(strtolower($filename), $ext)) {\n            return true;\n        }\n    }\n    \n    return false;\n}\n\n\/\/ URL\u691c\u8a3c\nfunction is_valid_url($url) {\n    return str_starts_with($url, 'http:\/\/') || str_starts_with($url, 'https:\/\/');\n}\n\n\/\/ \u691c\u7d22\u30ad\u30fc\u30ef\u30fc\u30c9\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\nfunction filter_products_by_keyword($products, $keyword) {\n    return array_filter($products, function($product) use ($keyword) {\n        return str_contains($product['name'], $keyword) || \n               str_contains($product['description'], $keyword);\n    });\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-102\">\u4eca\u5f8c\u671f\u5f85\u3055\u308c\u308b\u6587\u5b57\u5217\u691c\u7d22\u306e\u65b0\u6a5f\u80fd<\/h3>\n\n\n\n<p>PHP\u8a00\u8a9e\u306e\u9032\u5316\u306b\u4f34\u3044\u3001\u4eca\u5f8c\u3082\u6587\u5b57\u5217\u51e6\u7406\u306b\u95a2\u3059\u308b\u6a5f\u80fd\u306e\u62e1\u5145\u304c\u671f\u5f85\u3055\u308c\u307e\u3059\u3002\u4ee5\u4e0b\u306f\u3001\u5c06\u6765\u306ePHP\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u5b9f\u73fe\u3055\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u6a5f\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-103\">\u8907\u6570\u30d1\u30bf\u30fc\u30f3\u306e\u4e00\u81f4\u691c\u7d22<\/h4>\n\n\n\n<p>\u73fe\u5728\u3001\u8907\u6570\u306e\u30d1\u30bf\u30fc\u30f3\u3092\u4e00\u5ea6\u306b\u691c\u7d22\u3059\u308b\u306b\u306f\u3001\u914d\u5217\u3068<code>foreach<\/code>\u30eb\u30fc\u30d7\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u304b\u3001\u6b63\u898f\u8868\u73fe\u3092\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u5c06\u6765\u7684\u306b\u306f\u3001\u8907\u6570\u30d1\u30bf\u30fc\u30f3\u306e\u691c\u7d22\u3092\u52b9\u7387\u7684\u306b\u884c\u3046\u5c02\u7528\u95a2\u6570\u304c\u8ffd\u52a0\u3055\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\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=\"\">\/\/ \u5c06\u6765\u7684\u306b\u5b9f\u73fe\u3055\u308c\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u95a2\u6570\uff08\u73fe\u5728\u306f\u5b58\u5728\u3057\u307e\u305b\u3093\uff09\n$haystack = \"PHP\u306e\u9032\u5316\u306f\u6b62\u307e\u3089\u306a\u3044\";\n$needles = [\"PHP\", \"\u9032\u5316\", \"Java\"];\n\n\/\/ \u4eee\u60f3\u7684\u306a\u95a2\u6570\u306e\u4f8b\n$result = str_contains_any($haystack, $needles); \/\/ true\n$found = str_find_all($haystack, $needles); \/\/ [\"PHP\", \"\u9032\u5316\"]\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-104\">\u3088\u308a\u67d4\u8edf\u306a\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u30f3\u30b0<\/h4>\n\n\n\n<p>\u30b7\u30f3\u30d7\u30eb\u306a\u6b63\u898f\u8868\u73fe\u306e\u3088\u3046\u306a\u67d4\u8edf\u6027\u3068\u3001\u30b7\u30f3\u30d7\u30eb\u306a\u6587\u5b57\u5217\u95a2\u6570\u306e\u3088\u3046\u306a\u8aad\u307f\u3084\u3059\u3055\u3092\u517c\u306d\u5099\u3048\u305f\u3001\u4e2d\u9593\u7684\u306a\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u30f3\u30b0\u6a5f\u80fd\u304c\u5c0e\u5165\u3055\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\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=\"\">\/\/ \u4eee\u60f3\u7684\u306a\u95a2\u6570\u306e\u4f8b\n$email = \"user@example.com\";\n\n\/\/ \u30b7\u30f3\u30d7\u30eb\u306a\u30ef\u30a4\u30eb\u30c9\u30ab\u30fc\u30c9\u30de\u30c3\u30c1\u30f3\u30b0\n$result = str_match($email, \"*@example.com\"); \/\/ true\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-105\">\u6587\u5b57\u5217\u51e6\u7406\u306e\u62e1\u5f35API<\/h4>\n\n\n\n<p>\u3088\u308a\u9ad8\u5ea6\u306a\u6587\u5b57\u5217\u64cd\u4f5c\u3092\u7c21\u5358\u306b\u884c\u3048\u308bAPI\u304c\u5c06\u6765\u7684\u306b\u5c0e\u5165\u3055\u308c\u308b\u53ef\u80fd\u6027\u3082\u3042\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=\"\">\/\/ \u4eee\u60f3\u7684\u306aString\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u4f8b\n$str = new String(\"PHP\u306e\u6587\u5b57\u5217\u51e6\u7406\");\n$result = $str-&gt;contains(\"PHP\")      \/\/ true\n             -&gt;startsWith(\"PHP\")    \/\/ true\n             -&gt;replace(\"PHP\", \"PHP 8\")\n             -&gt;append(\"\u306e\u9032\u5316\")\n             -&gt;toString();          \/\/ \"PHP 8\u306e\u6587\u5b57\u5217\u51e6\u7406\u306e\u9032\u5316\"\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-106\">\u56fd\u969b\u5316\u5bfe\u5fdc\u306e\u5f37\u5316<\/h4>\n\n\n\n<p>Unicode\u51e6\u7406\u3084\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u5bfe\u5fdc\u306e\u5f37\u5316\u3082\u671f\u5f85\u3055\u308c\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=\"\">\/\/ \u4eee\u60f3\u7684\u306a\u56fd\u969b\u5316\u5bfe\u5fdc\u95a2\u6570\u306e\u4f8b\n$text = \"\u3053\u3093\u306b\u3061\u306f\u3001\u4e16\u754c\uff01\";\n\n\/\/ Unicode\u6b63\u898f\u5316\n$normalized = str_normalize($text, \"NFC\");\n\n\/\/ \u6587\u5b57\u5217\u306e\u97f3\u58f0\u8868\u8a18\u5909\u63db\n$romanized = str_transliterate($text, \"Latin\"); \/\/ \"konnichiwa, sekai!\"\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-107\">\u5b9f\u7528\u7684\u306a\u30c6\u30ad\u30b9\u30c8\u51e6\u7406\u95a2\u6570<\/h4>\n\n\n\n<p>\u30c6\u30ad\u30b9\u30c8\u51e6\u7406\u306b\u95a2\u9023\u3059\u308b\u4fbf\u5229\u306a\u95a2\u6570\u3082\u4eca\u5f8c\u8ffd\u52a0\u3055\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\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=\"\">\/\/ \u4eee\u60f3\u7684\u306a\u30c6\u30ad\u30b9\u30c8\u51e6\u7406\u95a2\u6570\u306e\u4f8b\n$text = \"PHP is a popular scripting language.\";\n\n\/\/ \u5358\u8a9e\u5206\u5272\n$words = str_words($text); \/\/ [\"PHP\", \"is\", \"a\", \"popular\", \"scripting\", \"language\"]\n\n\/\/ \u6587\u306e\u62bd\u51fa\n$text = \"Hello! How are you? I'm fine.\";\n$sentences = str_sentences($text); \/\/ [\"Hello!\", \"How are you?\", \"I'm fine.\"]\n\n\/\/ HTML\u30c6\u30ad\u30b9\u30c8\u62bd\u51fa\uff08\u30bf\u30b0\u3092\u9664\u53bb\uff09\n$html = \"&lt;p&gt;PHP\u306e&lt;strong&gt;\u6587\u5b57\u5217\u691c\u7d22&lt;\/strong&gt;\u6a5f\u80fd&lt;\/p&gt;\";\n$plain = str_extract_text($html); \/\/ \"PHP\u306e\u6587\u5b57\u5217\u691c\u7d22\u6a5f\u80fd\"\n<\/pre>\n\n\n\n<p>\u73fe\u6642\u70b9\u3067\u306f\u3001\u3053\u308c\u3089\u306f\u4eee\u60f3\u7684\u306a\u4f8b\u3067\u3059\u304c\u3001PHP\u306e\u6587\u5b57\u5217\u51e6\u7406\u6a5f\u80fd\u306f\u7740\u5b9f\u306b\u9032\u5316\u3057\u7d9a\u3051\u3066\u3044\u307e\u3059\u3002\u6700\u65b0\u306ePHP\u6a5f\u80fd\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u8aad\u307f\u3084\u3059\u304f\u52b9\u7387\u7684\u306a\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001PHP\u6587\u5b57\u5217\u691c\u7d22\u30c6\u30af\u30cb\u30c3\u30af\u306e\u52b9\u679c\u7684\u306a\u9078\u3073\u65b9\u306b\u3064\u3044\u3066\u307e\u3068\u3081\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-108\">\u307e\u3068\u3081\uff1a\u52b9\u679c\u7684\u306aPHP\u6587\u5b57\u5217\u691c\u7d22\u30c6\u30af\u30cb\u30c3\u30af\u306e\u9078\u3073\u65b9<\/h2>\n\n\n\n<p>\u672c\u8a18\u4e8b\u3067\u306f\u3001PHP\u306b\u304a\u3051\u308b\u6587\u5b57\u5217\u691c\u7d22\u306e\u57fa\u672c\u304b\u3089\u5fdc\u7528\u307e\u3067\u3001\u69d8\u3005\u306a\u30c6\u30af\u30cb\u30c3\u30af\u3068\u5b9f\u88c5\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u3066\u304d\u307e\u3057\u305f\u3002\u3053\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u5b9f\u969b\u306e\u958b\u767a\u30b7\u30fc\u30f3\u3067\u6700\u9069\u306a\u691c\u7d22\u95a2\u6570\u3092\u9078\u629e\u3059\u308b\u305f\u3081\u306e\u6307\u91dd\u3068\u3001\u3055\u3089\u306a\u308b\u5b66\u7fd2\u306e\u305f\u3081\u306e\u30ea\u30bd\u30fc\u30b9\u3092\u307e\u3068\u3081\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-109\">\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u5225\u304a\u3059\u3059\u3081\u691c\u7d22\u95a2\u6570\u4e00\u89a7<\/h3>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u8868\u306f\u3001\u69d8\u3005\u306a\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u306b\u5fdc\u3058\u305f\u6700\u9069\u306a\u6587\u5b57\u5217\u691c\u7d22\u95a2\u6570\u306e\u9078\u629e\u80a2\u3092\u307e\u3068\u3081\u305f\u3082\u306e\u3067\u3059\u3002\u5b9f\u969b\u306e\u958b\u767a\u306b\u304a\u3044\u3066\u3001\u3053\u306e\u8868\u3092\u53c2\u8003\u306b\u6700\u9069\u306a\u95a2\u6570\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n<div id=\"id-2038d419-4727-46ca-99b5-b5d47e6772ab\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9<\/th><th>PHP 8.0+<\/th><th>PHP 7.x<\/th><th>\u6ce8\u610f\u70b9<\/th><\/tr><\/thead><tbody><tr><td>\u5358\u7d14\u306a\u6587\u5b57\u5217\u306e\u5305\u542b\u30c1\u30a7\u30c3\u30af<\/td><td><code>str_contains()<\/code><\/td><td><code>strpos() !== false<\/code><\/td><td>PHP 8.0\u4ee5\u964d\u3067\u306f<code>str_contains()<\/code>\u304c\u53ef\u8aad\u6027\u306b\u512a\u308c\u308b<\/td><\/tr><tr><td>\u524d\u65b9\u4e00\u81f4\uff08\u30d7\u30ec\u30d5\u30a3\u30c3\u30af\u30b9\uff09<\/td><td><code>str_starts_with()<\/code><\/td><td><code>strpos() === 0<\/code><\/td><td>PHP 8.0\u4ee5\u964d\u3067\u306f\u524d\u65b9\u4e00\u81f4\u306b\u7279\u5316\u3057\u305f\u95a2\u6570\u304c\u3042\u308b<\/td><\/tr><tr><td>\u5f8c\u65b9\u4e00\u81f4\uff08\u30b5\u30d5\u30a3\u30c3\u30af\u30b9\uff09<\/td><td><code>str_ends_with()<\/code><\/td><td><code>substr() === needle<\/code><\/td><td>PHP 8.0\u4ee5\u964d\u3067\u306f\u5f8c\u65b9\u4e00\u81f4\u306b\u7279\u5316\u3057\u305f\u95a2\u6570\u304c\u3042\u308b<\/td><\/tr><tr><td>\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22<\/td><td><code>stripos()<\/code><\/td><td><code>stripos()<\/code><\/td><td><code>strtolower()<\/code>\u3068\u306e\u7d44\u307f\u5408\u308f\u305b\u3088\u308a\u3082\u52b9\u7387\u7684<\/td><\/tr><tr><td>\u65e5\u672c\u8a9e\u306a\u3069\u306e\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57<\/td><td><code>mb_strpos()<\/code><\/td><td><code>mb_strpos()<\/code><\/td><td>\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u6307\u5b9a\u3092\u5fd8\u308c\u305a\u306b<\/td><\/tr><tr><td>\u691c\u7d22\u3068\u90e8\u5206\u6587\u5b57\u5217\u53d6\u5f97<\/td><td><code>strstr()<\/code><\/td><td><code>strstr()<\/code><\/td><td>\u898b\u3064\u304b\u3063\u305f\u4f4d\u7f6e\u4ee5\u964d\u306e\u6587\u5b57\u5217\u3092\u53d6\u5f97<\/td><\/tr><tr><td>\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u30f3\u30b0<\/td><td><code>preg_match()<\/code><\/td><td><code>preg_match()<\/code><\/td><td>\u6b63\u898f\u8868\u73fe\u306e\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9\u306b\u6ce8\u610f<\/td><\/tr><tr><td>\u8907\u6570\u306e\u30de\u30c3\u30c1\u3092\u53d6\u5f97<\/td><td><code>preg_match_all()<\/code><\/td><td><code>preg_match_all()<\/code><\/td><td>\u7d50\u679c\u306e\u914d\u5217\u69cb\u9020\u3092\u7406\u89e3\u3057\u3066\u304a\u304f<\/td><\/tr><tr><td>\u8907\u6570\u306e\u6587\u5b57\u306e\u3044\u305a\u308c\u304b\u3092\u691c\u7d22<\/td><td><code>strpbrk()<\/code><\/td><td><code>strpbrk()<\/code><\/td><td>\u5358\u4e00\u6587\u5b57\u306e\u96c6\u5408\u306e\u307f\u5bfe\u5fdc<\/td><\/tr><tr><td>\u52b9\u7387\u7684\u306a\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u691c\u7d22<\/td><td>\u30b9\u30c8\u30ea\u30fc\u30e0 + <code>strpos()<\/code><\/td><td>\u30b9\u30c8\u30ea\u30fc\u30e0 + <code>strpos()<\/code><\/td><td>\u5927\u304d\u306a\u30d5\u30a1\u30a4\u30eb\u306f\u4e00\u5ea6\u306b\u8aad\u307f\u8fbc\u307e\u306a\u3044<\/td><\/tr><tr><td>\u30bb\u30ad\u30e5\u30a2\u306a\u691c\u7d22\u3068\u7f6e\u63db<\/td><td><code>htmlspecialchars()<\/code> + <code>str_replace()<\/code><\/td><td><code>htmlspecialchars()<\/code> + <code>str_replace()<\/code><\/td><td>\u5e38\u306b\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u306b\u5fdc\u3058\u305f\u30a8\u30b9\u30b1\u30fc\u30d7\u3092<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"i-110\">\u6587\u5b57\u5217\u691c\u7d22\u95a2\u6570\u9078\u629e\u306e\u5224\u65ad\u57fa\u6e96<\/h3>\n\n\n\n<p>\u52b9\u679c\u7684\u306a\u6587\u5b57\u5217\u691c\u7d22\u95a2\u6570\u3092\u9078\u3076\u969b\u306f\u3001\u4ee5\u4e0b\u306e\u5224\u65ad\u57fa\u6e96\u3092\u8003\u616e\u3059\u308b\u3068\u826f\u3044\u3067\u3057\u3087\u3046\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u691c\u7d22\u306e\u76ee\u7684<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u5358\u7d14\u306a\u5b58\u5728\u78ba\u8a8d\u306a\u306e\u304b\uff1f<\/li>\n\n\n\n<li>\u4f4d\u7f6e\u306e\u7279\u5b9a\u304c\u5fc5\u8981\u304b\uff1f<\/li>\n\n\n\n<li>\u90e8\u5206\u6587\u5b57\u5217\u306e\u62bd\u51fa\u3092\u4f34\u3046\u304b\uff1f<\/li>\n\n\n\n<li>\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u30f3\u30b0\u304c\u5fc5\u8981\u304b\uff1f<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u8981\u4ef6<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u51e6\u7406\u3059\u308b\u304b\uff1f<\/li>\n\n\n\n<li>\u51e6\u7406\u901f\u5ea6\u304c\u91cd\u8981\u304b\uff1f<\/li>\n\n\n\n<li>\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3092\u6291\u3048\u308b\u5fc5\u8981\u304c\u3042\u308b\u304b\uff1f<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u7279\u6b8a\u306a\u8981\u4ef6<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\uff08\u65e5\u672c\u8a9e\u306a\u3069\uff09\u3092\u6271\u3046\u304b\uff1f<\/li>\n\n\n\n<li>\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u304b\uff1f<\/li>\n\n\n\n<li>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u4e0a\u306e\u8003\u616e\u4e8b\u9805\u306f\u3042\u308b\u304b\uff1f<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>PHP\u74b0\u5883<\/strong>\n<ul class=\"wp-block-list\">\n<li>PHP 8.0\u4ee5\u964d\u3092\u4f7f\u7528\u3067\u304d\u308b\u304b\uff1f<\/li>\n\n\n\n<li>\u30ec\u30ac\u30b7\u30fc\u30b3\u30fc\u30c9\u3068\u306e\u4e92\u63db\u6027\u306f\u5fc5\u8981\u304b\uff1f<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u57fa\u6e96\u306b\u57fa\u3065\u3044\u3066\u9069\u5207\u306a\u95a2\u6570\u3092\u9078\u629e\u3059\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u52b9\u7387\u7684\u3067\u4fdd\u5b88\u6027\u306e\u9ad8\u3044\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-111\">\u3055\u3089\u306a\u308b\u5b66\u7fd2\u30ea\u30bd\u30fc\u30b9\u3068\u53c2\u8003\u60c5\u5831<\/h3>\n\n\n\n<p>PHP\u306e\u6587\u5b57\u5217\u691c\u7d22\u3068\u64cd\u4f5c\u306b\u3064\u3044\u3066\u3055\u3089\u306b\u6df1\u304f\u5b66\u3076\u305f\u3081\u306e\u512a\u308c\u305f\u30ea\u30bd\u30fc\u30b9\u3092\u3044\u304f\u3064\u304b\u7d39\u4ecb\u3057\u307e\u3059\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/strong>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.php.net\/manual\/ja\/ref.strings.php\">PHP \u516c\u5f0f\u30de\u30cb\u30e5\u30a2\u30eb: \u6587\u5b57\u5217\u95a2\u6570<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.php.net\/manual\/ja\/ref.mbstring.php\">PHP \u516c\u5f0f\u30de\u30cb\u30e5\u30a2\u30eb: \u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u5217\u95a2\u6570<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.php.net\/manual\/ja\/ref.pcre.php\">PHP \u516c\u5f0f\u30de\u30cb\u30e5\u30a2\u30eb: \u6b63\u898f\u8868\u73fe\u95a2\u6570\uff08PCRE\uff09<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u5b66\u7fd2\u30b5\u30a4\u30c8\u3068\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb<\/strong>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/phptherightway.com\/\">PHP The Right Way<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/phpdelusions.net\/\">PHP Delusions<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/phpapprentice.com\/\">PHP Apprentice<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316<\/strong>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/phpbench.com\/\">PHP\u30d9\u30f3\u30c1\u30de\u30fc\u30af<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.sitepoint.com\/php-optimization-performance-tuning\/\">PHP: Optimization and Performance Tuning<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/strong>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/PHP_Security_Cheat_Sheet.html\">OWASP PHP Security Cheat Sheet<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/phpsecurity.org\/\">PHP \u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30b3\u30f3\u30bd\u30fc\u30b7\u30a2\u30e0<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-112\">PHP\u3067\u306e\u6587\u5b57\u5217\u691c\u7d22\u30b9\u30ad\u30eb\u3092\u6d3b\u304b\u3059\u5206\u91ce<\/h3>\n\n\n\n<p>\u672c\u8a18\u4e8b\u3067\u5b66\u3093\u3060\u6587\u5b57\u5217\u691c\u7d22\u30c6\u30af\u30cb\u30c3\u30af\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u69d8\u3005\u306a\u5206\u91ce\u3067\u6d3b\u7528\u3067\u304d\u307e\u3059\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a<\/strong>: \u30d5\u30a9\u30fc\u30e0\u5165\u529b\u306e\u691c\u8a3c\u3001URL\u89e3\u6790\u3001\u30b3\u30f3\u30c6\u30f3\u30c4\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0<\/li>\n\n\n\n<li><strong>\u30c7\u30fc\u30bf\u51e6\u7406\u30fb\u5909\u63db<\/strong>: CSV\/XML\u30c7\u30fc\u30bf\u306e\u89e3\u6790\u3001\u30c7\u30fc\u30bf\u30af\u30ec\u30f3\u30b8\u30f3\u30b0\u3001\u5f62\u5f0f\u5909\u63db<\/li>\n\n\n\n<li><strong>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5b9f\u88c5<\/strong>: \u5165\u529b\u30b5\u30cb\u30bf\u30a4\u30ba\u3001XSS\u5bfe\u7b56\u3001SQL\u30a4\u30f3\u30b8\u30a7\u30af\u30b7\u30e7\u30f3\u9632\u6b62<\/li>\n\n\n\n<li><strong>\u30b7\u30b9\u30c6\u30e0\u7ba1\u7406<\/strong>: \u30ed\u30b0\u89e3\u6790\u3001\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u51e6\u7406\u3001\u30d0\u30c3\u30c1\u51e6\u7406<\/li>\n\n\n\n<li><strong>\u30b3\u30f3\u30c6\u30f3\u30c4\u7ba1\u7406<\/strong>: \u5168\u6587\u691c\u7d22\u3001\u30bf\u30b0\u62bd\u51fa\u3001\u30e1\u30bf\u30c7\u30fc\u30bf\u51e6\u7406<\/li>\n\n\n\n<li><strong>\u30c7\u30fc\u30bf\u30de\u30a4\u30cb\u30f3\u30b0<\/strong>: \u30d1\u30bf\u30fc\u30f3\u62bd\u51fa\u3001\u30c6\u30ad\u30b9\u30c8\u5206\u985e\u3001\u611f\u60c5\u5206\u6790<\/li>\n<\/ul>\n\n\n\n<p>PHP\u306e\u6587\u5b57\u5217\u691c\u7d22\u306f\u3001\u5358\u306a\u308b\u57fa\u672c\u30b9\u30ad\u30eb\u3067\u306f\u306a\u304f\u3001\u52b9\u7387\u7684\u3067\u5b89\u5168\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306e\u305f\u3081\u306e\u91cd\u8981\u306a\u571f\u53f0\u3068\u306a\u308a\u307e\u3059\u3002\u6700\u9069\u306a\u95a2\u6570\u3068\u5b9f\u88c5\u30d1\u30bf\u30fc\u30f3\u3092\u9078\u629e\u3059\u308b\u3053\u3068\u3067\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3068\u4fdd\u5b88\u6027\u3092\u4e21\u7acb\u3057\u305f\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u672c\u8a18\u4e8b\u3067\u7d39\u4ecb\u3057\u305f\u30c6\u30af\u30cb\u30c3\u30af\u3092\u5b9f\u969b\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u5fdc\u7528\u3057\u3001\u3055\u3089\u306b\u7d4c\u9a13\u3092\u7a4d\u3080\u3053\u3068\u3067\u3001\u3088\u308a\u9ad8\u5ea6\u306a\u6587\u5b57\u5217\u51e6\u7406\u30b9\u30ad\u30eb\u3092\u7fd2\u5f97\u3057\u3066\u3044\u305f\u3060\u3051\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-113\">\u88dc\u8db3\uff1a\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u307e\u3068\u3081<\/h2>\n\n\n\n<p>\u3053\u306e\u88dc\u8db3\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u672c\u8a18\u4e8b\u3067\u7d39\u4ecb\u3057\u305f\u6587\u5b57\u5217\u691c\u7d22\u306e\u5404\u30c6\u30af\u30cb\u30c3\u30af\u306b\u3064\u3044\u3066\u3001\u3059\u3050\u306b\u4f7f\u3048\u308b\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u307e\u3068\u3081\u3066\u63d0\u4f9b\u3057\u307e\u3059\u3002\u5b9f\u969b\u306e\u958b\u767a\u3067\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u30b3\u30d4\u30fc\uff06\u30da\u30fc\u30b9\u30c8\u3057\u3066\u6d3b\u7528\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-114\">\u3053\u306e\u8a18\u4e8b\u3067\u7d39\u4ecb\u3057\u305f\u5168\u691c\u7d22\u30c6\u30af\u30cb\u30c3\u30af\u306e\u30b3\u30fc\u30c9\u30b9\u30cb\u30da\u30c3\u30c8\u96c6<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-115\">1. \u57fa\u672c\u7684\u306a\u6587\u5b57\u5217\u691c\u7d22<\/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;?php\n\/\/ strpos() - \u6700\u521d\u306e\u51fa\u73fe\u4f4d\u7f6e\u3092\u691c\u7d22\nfunction demo_strpos() {\n    $text = \"PHP\u306b\u3088\u308b\u6587\u5b57\u5217\u691c\u7d22\u306e\u30b5\u30f3\u30d7\u30eb\u3067\u3059\u3002PHP\u8a00\u8a9e\u3067\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3002\";\n    $needle = \"PHP\";\n    \n    \/\/ \u6700\u521d\u306e\u51fa\u73fe\u4f4d\u7f6e\u3092\u691c\u7d22\n    $pos = strpos($text, $needle);\n    \n    \/\/ \u6b63\u3057\u3044\u691c\u7d22\u7d50\u679c\u306e\u78ba\u8a8d\u65b9\u6cd5\uff08\u4f4d\u7f6e\u304c0\u306e\u5834\u5408\u3082\u3042\u308b\uff09\n    if ($pos !== false) {\n        echo \"\u300c{$needle}\u300d\u304c\u4f4d\u7f6e {$pos} \u3067\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002\\n\";\n    } else {\n        echo \"\u300c{$needle}\u300d\u306f\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002\\n\";\n    }\n    \n    \/\/ 2\u756a\u76ee\u306e\u51fa\u73fe\u4f4d\u7f6e\u3092\u691c\u7d22\n    $second_pos = strpos($text, $needle, $pos + 1);\n    if ($second_pos !== false) {\n        echo \"\u300c{$needle}\u300d\u306e2\u756a\u76ee\u306e\u51fa\u73fe\u4f4d\u7f6e: {$second_pos}\\n\";\n    }\n}\n\n\/\/ strrpos() - \u6700\u5f8c\u306e\u51fa\u73fe\u4f4d\u7f6e\u3092\u691c\u7d22\nfunction demo_strrpos() {\n    $text = \"PHP\u306b\u3088\u308b\u6587\u5b57\u5217\u691c\u7d22\u306e\u30b5\u30f3\u30d7\u30eb\u3067\u3059\u3002PHP\u8a00\u8a9e\u3067\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3002\";\n    $needle = \"PHP\";\n    \n    \/\/ \u6700\u5f8c\u306e\u51fa\u73fe\u4f4d\u7f6e\u3092\u691c\u7d22\n    $pos = strrpos($text, $needle);\n    \n    if ($pos !== false) {\n        echo \"\u300c{$needle}\u300d\u306e\u6700\u5f8c\u306e\u51fa\u73fe\u4f4d\u7f6e: {$pos}\\n\";\n    }\n    \n    \/\/ \u7279\u5b9a\u4f4d\u7f6e\u3088\u308a\u524d\u306e\u6700\u5f8c\u306e\u51fa\u73fe\u4f4d\u7f6e\n    $before_pos = strrpos($text, $needle, -20); \/\/ \u672b\u5c3e\u304b\u308920\u6587\u5b57\u524d\u3088\u308a\u524d\u3092\u691c\u7d22\n    if ($before_pos !== false) {\n        echo \"\u672b\u5c3e\u304b\u308920\u6587\u5b57\u524d\u3088\u308a\u524d\u306e\u300c{$needle}\u300d\u306e\u6700\u5f8c\u306e\u51fa\u73fe\u4f4d\u7f6e: {$before_pos}\\n\";\n    }\n}\n\n\/\/ str_contains() - \u6587\u5b57\u5217\u5305\u542b\u30c1\u30a7\u30c3\u30af\uff08PHP 8.0\u4ee5\u964d\uff09\nfunction demo_str_contains() {\n    \/\/ PHP 8.0\u4ee5\u964d\u3067\u306e\u307f\u52d5\u4f5c\n    if (!function_exists('str_contains')) {\n        echo \"\u3053\u306e\u95a2\u6570\u306fPHP 8.0\u4ee5\u964d\u3067\u5229\u7528\u53ef\u80fd\u3067\u3059\u3002\\n\";\n        return;\n    }\n    \n    $text = \"PHP\u306b\u3088\u308b\u6587\u5b57\u5217\u691c\u7d22\u306e\u30b5\u30f3\u30d7\u30eb\u3067\u3059\u3002\";\n    \n    \/\/ \u6587\u5b57\u5217\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u304b\u3092\u30c1\u30a7\u30c3\u30af\n    if (str_contains($text, \"PHP\")) {\n        echo \"\u300cPHP\u300d\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002\\n\";\n    }\n    \n    \/\/ \u542b\u307e\u308c\u3066\u3044\u306a\u3044\u5834\u5408\n    if (!str_contains($text, \"Python\")) {\n        echo \"\u300cPython\u300d\u306f\u542b\u307e\u308c\u3066\u3044\u307e\u305b\u3093\u3002\\n\";\n    }\n}\n\n\/\/ strstr()\/stristr() - \u691c\u7d22\u3068\u90e8\u5206\u6587\u5b57\u5217\u53d6\u5f97\nfunction demo_strstr() {\n    $text = \"\u304a\u554f\u3044\u5408\u308f\u305b: info@example.com \u307e\u3067\";\n    \n    \/\/ @\u4ee5\u964d\u3092\u53d6\u5f97\n    $domain_part = strstr($text, \"@\");\n    echo \"\u53d6\u5f97\u3057\u305f\u90e8\u5206: {$domain_part}\\n\"; \/\/ \"@example.com \u307e\u3067\"\n    \n    \/\/ @\u3088\u308a\u524d\u3092\u53d6\u5f97\n    $username_part = strstr($text, \"@\", true);\n    echo \"\u53d6\u5f97\u3057\u305f\u90e8\u5206\uff08@\u3088\u308a\u524d\uff09: {$username_part}\\n\"; \/\/ \"\u304a\u554f\u3044\u5408\u308f\u305b: info\"\n    \n    \/\/ \u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22\n    $text2 = \"PHP\u306e\u52c9\u5f37\u3092\u3057\u3066\u3044\u307e\u3059\u3002php\u306f\u697d\u3057\u3044\u3067\u3059\u3002\";\n    $php_part = stristr($text2, \"php\");\n    echo \"\u53d6\u5f97\u3057\u305f\u90e8\u5206\uff08\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u533a\u5225\u306a\u3057\uff09: {$php_part}\\n\"; \/\/ \"PHP\u306e\u52c9\u5f37\u3092\u3057\u3066\u3044\u307e\u3059\u3002php\u306f\u697d\u3057\u3044\u3067\u3059\u3002\"\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-116\">2. \u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22<\/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;?php\n\/\/ stripos() - \u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u4f4d\u7f6e\u691c\u7d22\nfunction demo_stripos() {\n    $text = \"PHP\u306e\u52c9\u5f37\u3092\u3057\u3066\u3044\u307e\u3059\u3002php\u306f\u697d\u3057\u3044\u3067\u3059\u3002\";\n    \n    \/\/ \u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u305b\u305a\u306b\u691c\u7d22\n    $pos = stripos($text, \"php\");\n    \n    if ($pos !== false) {\n        echo \"\u300cphp\u300d\u304c\u4f4d\u7f6e {$pos} \u3067\u898b\u3064\u304b\u308a\u307e\u3057\u305f\uff08\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u533a\u5225\u306a\u3057\uff09\u3002\\n\";\n    }\n    \n    \/\/ 2\u756a\u76ee\u306e\u51fa\u73fe\u4f4d\u7f6e\n    $second_pos = stripos($text, \"php\", $pos + 1);\n    if ($second_pos !== false) {\n        echo \"\u300cphp\u300d\u306e2\u756a\u76ee\u306e\u51fa\u73fe\u4f4d\u7f6e: {$second_pos}\\n\";\n    }\n}\n\n\/\/ strtolower()\/strtoupper() + strpos() - \u5909\u63db\u3057\u3066\u304b\u3089\u691c\u7d22\nfunction demo_case_conversion_search() {\n    $text = \"PHP\u306e\u52c9\u5f37\u3092\u3057\u3066\u3044\u307e\u3059\u3002php\u306f\u697d\u3057\u3044\u3067\u3059\u3002\";\n    $search = \"PHP\";\n    \n    \/\/ \u4e21\u65b9\u3092\u5c0f\u6587\u5b57\u306b\u5909\u63db\u3057\u3066\u691c\u7d22\n    $lower_text = strtolower($text);\n    $lower_search = strtolower($search);\n    \n    $positions = [];\n    $pos = 0;\n    \n    \/\/ \u3059\u3079\u3066\u306e\u51fa\u73fe\u4f4d\u7f6e\u3092\u691c\u7d22\n    while (($pos = strpos($lower_text, $lower_search, $pos)) !== false) {\n        $positions[] = $pos;\n        $pos++;\n    }\n    \n    echo \"\u300c{$search}\u300d\u304c\u898b\u3064\u304b\u3063\u305f\u4f4d\u7f6e\uff08\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u533a\u5225\u306a\u3057\uff09: \" . implode(\", \", $positions) . \"\\n\";\n}\n\n\/\/ mb_stripos() - \u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u5bfe\u5fdc\u306e\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22\nfunction demo_mb_stripos() {\n    $text = \"PHP\u3067\u300c\u6587\u5b57\u5217\u300d\u3092\u691c\u7d22\u3057\u307e\u3059\u3002php\u306e\u6a5f\u80fd\u3092\u4f7f\u3063\u3066\u3002\";\n    \n    \/\/ \u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u5bfe\u5fdc\u306e\u691c\u7d22\n    $pos = mb_stripos($text, \"php\", 0, \"UTF-8\");\n    \n    if ($pos !== false) {\n        echo \"\u300cphp\u300d\u304c\u6587\u5b57\u4f4d\u7f6e {$pos} \u3067\u898b\u3064\u304b\u308a\u307e\u3057\u305f\uff08\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u5bfe\u5fdc\uff09\u3002\\n\";\n    }\n    \n    \/\/ \u65e5\u672c\u8a9e\u306e\u691c\u7d22\n    $pos_jp = mb_stripos($text, \"\u6587\u5b57\u5217\", 0, \"UTF-8\");\n    if ($pos_jp !== false) {\n        echo \"\u300c\u6587\u5b57\u5217\u300d\u304c\u6587\u5b57\u4f4d\u7f6e {$pos_jp} \u3067\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002\\n\";\n    }\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-117\">3. \u8907\u6570\u306e\u6587\u5b57\u5217\u30d1\u30bf\u30fc\u30f3\u3092\u4e00\u5ea6\u306b\u691c\u7d22<\/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;?php\n\/\/ strpbrk() - \u8907\u6570\u306e\u6587\u5b57\u306e\u3044\u305a\u308c\u304b\u3092\u691c\u7d22\nfunction demo_strpbrk() {\n    $text = \"PHP\u306b\u3088\u308b\u6587\u5b57\u5217\u691c\u7d22\u306e\u4f8b: sample@example.com\";\n    \n    \/\/ \u7279\u5b9a\u306e\u6587\u5b57\u30bb\u30c3\u30c8\u306e\u3044\u305a\u308c\u304b\u304c\u6700\u521d\u306b\u73fe\u308c\u308b\u4f4d\u7f6e\u3092\u691c\u7d22\n    $result = strpbrk($text, \"@.:;\");\n    \n    echo \"\u53d6\u5f97\u3055\u308c\u305f\u90e8\u5206: {$result}\\n\"; \/\/ \"@example.com\"\n    \n    \/\/ \u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u304b\u3089\u30c9\u30e1\u30a4\u30f3\u3092\u62bd\u51fa\u3059\u308b\u4f8b\n    $email = \"user@example.com\";\n    $domain = strpbrk($email, \"@\");\n    echo \"\u30c9\u30e1\u30a4\u30f3\u90e8\u5206: {$domain}\\n\"; \/\/ \"@example.com\"\n}\n\n\/\/ array_filter() - \u8907\u6570\u30d1\u30bf\u30fc\u30f3\u306b\u3088\u308b\u914d\u5217\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\nfunction demo_array_filter_search() {\n    $sentences = [\n        \"PHP\u306fWeb\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306b\u6700\u9069\u306a\u8a00\u8a9e\u3067\u3059\u3002\",\n        \"JavaScript\u306f\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u958b\u767a\u306b\u4f7f\u308f\u308c\u307e\u3059\u3002\",\n        \"PHP\u3068MySQL\u306e\u7d44\u307f\u5408\u308f\u305b\u304c\u4e00\u822c\u7684\u3067\u3059\u3002\",\n        \"\u591a\u304f\u306eCMS\u304cPHP\u3067\u4f5c\u3089\u308c\u3066\u3044\u307e\u3059\u3002\"\n    ];\n    \n    $keywords = [\"PHP\", \"MySQL\"];\n    \n    \/\/ \u3044\u305a\u308c\u304b\u306e\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u542b\u3080\u6587\u3092\u62bd\u51fa\n    $filtered = array_filter($sentences, function($sentence) use ($keywords) {\n        foreach ($keywords as $keyword) {\n            if (stripos($sentence, $keyword) !== false) {\n                return true;\n            }\n        }\n        return false;\n    });\n    \n    echo \"\u62bd\u51fa\u3055\u308c\u305f\u6587:\\n\";\n    foreach ($filtered as $sentence) {\n        echo \"- {$sentence}\\n\";\n    }\n}\n\n\/\/ \u72ec\u81ea\u306e\u30ad\u30fc\u30ef\u30fc\u30c9\u691c\u7d22\u95a2\u6570\nfunction demo_custom_keywords_search() {\n    $text = \"PHP\u306fWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306b\u5e83\u304f\u4f7f\u308f\u308c\u3066\u3044\u307e\u3059\u3002PHP\u306f\u591a\u304f\u306e\u30ec\u30f3\u30bf\u30eb\u30b5\u30fc\u30d0\u30fc\u3067\u5229\u7528\u53ef\u80fd\u3067\u3059\u3002\";\n    $keywords = [\"PHP\", \"Web\", \"\u958b\u767a\", \"JavaScript\"];\n    \n    \/\/ \u5404\u30ad\u30fc\u30ef\u30fc\u30c9\u306e\u51fa\u73fe\u56de\u6570\u3092\u30ab\u30a6\u30f3\u30c8\n    $counts = [];\n    foreach ($keywords as $keyword) {\n        $count = substr_count(strtolower($text), strtolower($keyword));\n        if ($count &gt; 0) {\n            $counts[$keyword] = $count;\n        }\n    }\n    \n    echo \"\u30ad\u30fc\u30ef\u30fc\u30c9\u306e\u51fa\u73fe\u56de\u6570:\\n\";\n    foreach ($counts as $keyword =&gt; $count) {\n        echo \"{$keyword}: {$count}\u56de\\n\";\n    }\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-118\">4. \u6b63\u898f\u8868\u73fe\u306b\u3088\u308b\u691c\u7d22<\/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;?php\n\/\/ preg_match() - \u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u30f3\u30b0\nfunction demo_preg_match() {\n    $text = \"\u9023\u7d61\u5148: user@example.com \u307e\u305f\u306f 090-1234-5678\";\n    \n    \/\/ \u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u62bd\u51fa\n    if (preg_match('\/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}\/', $text, $matches)) {\n        echo \"\u62bd\u51fa\u3055\u308c\u305f\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9: {$matches[0]}\\n\";\n    }\n    \n    \/\/ \u96fb\u8a71\u756a\u53f7\u3092\u62bd\u51fa\n    if (preg_match('\/\\d{2,4}-\\d{2,4}-\\d{4}\/', $text, $matches)) {\n        echo \"\u62bd\u51fa\u3055\u308c\u305f\u96fb\u8a71\u756a\u53f7: {$matches[0]}\\n\";\n    }\n}\n\n\/\/ preg_match_all() - \u8907\u6570\u30de\u30c3\u30c1\u306e\u62bd\u51fa\nfunction demo_preg_match_all() {\n    $html = '&lt;p&gt;PHP\u306b\u306f&lt;a href=\"https:\/\/www.php.net\"&gt;\u516c\u5f0f\u30b5\u30a4\u30c8&lt;\/a&gt;\u304c\u3042\u308a\u307e\u3059\u3002\n             \u307e\u305f\u3001&lt;a href=\"https:\/\/www.example.com\"&gt;\u30b5\u30f3\u30d7\u30eb\u30b5\u30a4\u30c8&lt;\/a&gt;\u3082\u3042\u308a\u307e\u3059\u3002&lt;\/p&gt;';\n    \n    \/\/ \u3059\u3079\u3066\u306e\u30ea\u30f3\u30afURL\u3092\u62bd\u51fa\n    preg_match_all('\/&lt;a href=\"([^\"]+)\"\/', $html, $matches);\n    \n    echo \"\u62bd\u51fa\u3055\u308c\u305fURL:\\n\";\n    foreach ($matches[1] as $url) {\n        echo \"- {$url}\\n\";\n    }\n    \n    \/\/ \u540d\u524d\u4ed8\u304d\u30ad\u30e3\u30d7\u30c1\u30e3\u30b0\u30eb\u30fc\u30d7\u3092\u4f7f\u7528\u3057\u305f\u4f8b\n    $text = \"\u540d\u524d: \u5c71\u7530\u592a\u90ce, \u5e74\u9f62: 30\u6b73, \u4f4f\u6240: \u6771\u4eac\u90fd\u6e0b\u8c37\u533a\";\n    preg_match_all('\/(?&lt;key&gt;[^:]+): (?&lt;value&gt;[^,]+)(,|$)\/', $text, $matches, PREG_SET_ORDER);\n    \n    echo \"\\n\u62bd\u51fa\u3055\u308c\u305f\u60c5\u5831:\\n\";\n    foreach ($matches as $match) {\n        $key = trim($match['key']);\n        $value = trim($match['value']);\n        echo \"{$key} =&gt; {$value}\\n\";\n    }\n}\n\n\/\/ preg_replace() - \u30d1\u30bf\u30fc\u30f3\u7f6e\u63db\nfunction demo_preg_replace() {\n    $text = \"\u79c1\u306e\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306f user@example.com \u3067\u3059\u3002\u96fb\u8a71\u756a\u53f7\u306f 090-1234-5678 \u3067\u3059\u3002\";\n    \n    \/\/ \u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u30de\u30b9\u30af\n    $masked_email = preg_replace('\/([a-zA-Z0-9._%+-]+)@([a-zA-Z0-9.-]+\\.[a-zA-Z]{2,})\/', '***@$2', $text);\n    echo \"\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u30de\u30b9\u30af: {$masked_email}\\n\";\n    \n    \/\/ \u96fb\u8a71\u756a\u53f7\u3092\u30de\u30b9\u30af\n    $masked_phone = preg_replace('\/(\\d{2,4})-(\\d{2,4})-(\\d{4})\/', '$1-****-$3', $text);\n    echo \"\u96fb\u8a71\u756a\u53f7\u3092\u30de\u30b9\u30af: {$masked_phone}\\n\";\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-119\">5. \u52b9\u7387\u7684\u306a\u6587\u5b57\u5217\u691c\u7d22\u306e\u5b9f\u88c5<\/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;?php\n\/\/ \u30b9\u30c8\u30ea\u30fc\u30e0\u51e6\u7406\u306b\u3088\u308b\u5927\u304d\u306a\u30d5\u30a1\u30a4\u30eb\u306e\u691c\u7d22\nfunction demo_large_file_search($file_path, $search_term) {\n    if (!file_exists($file_path)) {\n        echo \"\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3057\u307e\u305b\u3093: {$file_path}\\n\";\n        return [];\n    }\n    \n    $found_lines = [];\n    $handle = fopen($file_path, 'r');\n    $line_number = 0;\n    \n    if ($handle) {\n        while (($line = fgets($handle)) !== false) {\n            $line_number++;\n            if (strpos($line, $search_term) !== false) {\n                $found_lines[] = [\n                    'line' =&gt; $line_number,\n                    'content' =&gt; trim($line)\n                ];\n            }\n        }\n        fclose($handle);\n    }\n    \n    return $found_lines;\n}\n\n\/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u4f7f\u7528\u3057\u305f\u6587\u5b57\u5217\u691c\u7d22\nfunction demo_cached_search($text, $patterns, $cache_time = 3600) {\n    $cache_key = md5($text . serialize($patterns));\n    $cache_file = sys_get_temp_dir() . '\/search_cache_' . $cache_key;\n    \n    \/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u304c\u3042\u308c\u3070\u4f7f\u7528\n    if (file_exists($cache_file) &amp;&amp; (time() - filemtime($cache_file) &lt; $cache_time)) {\n        $results = unserialize(file_get_contents($cache_file));\n        echo \"\u30ad\u30e3\u30c3\u30b7\u30e5\u304b\u3089\u7d50\u679c\u3092\u53d6\u5f97\u3057\u307e\u3057\u305f\\n\";\n        return $results;\n    }\n    \n    \/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u304c\u306a\u3051\u308c\u3070\u691c\u7d22\u3092\u5b9f\u884c\n    $results = [];\n    foreach ($patterns as $pattern) {\n        if (stripos($text, $pattern) !== false) {\n            $results[] = $pattern;\n        }\n    }\n    \n    \/\/ \u7d50\u679c\u3092\u30ad\u30e3\u30c3\u30b7\u30e5\u306b\u4fdd\u5b58\n    file_put_contents($cache_file, serialize($results));\n    echo \"\u691c\u7d22\u3092\u5b9f\u884c\u3057\u3001\u7d50\u679c\u3092\u30ad\u30e3\u30c3\u30b7\u30e5\u3057\u307e\u3057\u305f\\n\";\n    \n    return $results;\n}\n\n\/\/ \u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u3092\u4f7f\u7528\u3057\u305f\u52b9\u7387\u7684\u306a\u691c\u7d22\nfunction search_generator($text, $search_term) {\n    $lines = explode(\"\\n\", $text);\n    $line_number = 0;\n    \n    foreach ($lines as $line) {\n        $line_number++;\n        if (strpos($line, $search_term) !== false) {\n            yield [\n                'line' =&gt; $line_number,\n                'content' =&gt; $line\n            ];\n        }\n    }\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-120\">6. PHP \u30d0\u30fc\u30b8\u30e7\u30f3\u5225\u306e\u6587\u5b57\u5217\u691c\u7d22<\/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;?php\n\/\/ PHP\u30d0\u30fc\u30b8\u30e7\u30f3\u9593\u306e\u4e92\u63db\u6027\u3092\u6301\u305f\u305b\u308b\u5b9f\u88c5\nfunction str_contains_compat($haystack, $needle) {\n    \/\/ PHP 8.0\u4ee5\u964d\u3067\u306f\u30cd\u30a4\u30c6\u30a3\u30d6\u95a2\u6570\u3092\u4f7f\u7528\n    if (function_exists('str_contains')) {\n        return str_contains($haystack, $needle);\n    }\n    \n    \/\/ PHP 7.x\u4ee5\u524d\u3067\u306e\u4ee3\u66ff\u5b9f\u88c5\n    return $needle === '' || strpos($haystack, $needle) !== false;\n}\n\nfunction str_starts_with_compat($haystack, $needle) {\n    \/\/ PHP 8.0\u4ee5\u964d\u3067\u306f\u30cd\u30a4\u30c6\u30a3\u30d6\u95a2\u6570\u3092\u4f7f\u7528\n    if (function_exists('str_starts_with')) {\n        return str_starts_with($haystack, $needle);\n    }\n    \n    \/\/ PHP 7.x\u4ee5\u524d\u3067\u306e\u4ee3\u66ff\u5b9f\u88c5\n    return $needle === '' || strpos($haystack, $needle) === 0;\n}\n\nfunction str_ends_with_compat($haystack, $needle) {\n    \/\/ PHP 8.0\u4ee5\u964d\u3067\u306f\u30cd\u30a4\u30c6\u30a3\u30d6\u95a2\u6570\u3092\u4f7f\u7528\n    if (function_exists('str_ends_with')) {\n        return str_ends_with($haystack, $needle);\n    }\n    \n    \/\/ PHP 7.x\u4ee5\u524d\u3067\u306e\u4ee3\u66ff\u5b9f\u88c5\n    $length = strlen($needle);\n    return $length === 0 || substr($haystack, -$length) === $needle;\n}\n\n\/\/ \u4f7f\u7528\u4f8b\nfunction demo_compat_functions() {\n    $text = \"PHP\u306f\u4eba\u6c17\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u8a00\u8a9e\u3067\u3059\";\n    \n    echo \"str_contains_compat: \" . (str_contains_compat($text, \"PHP\") ? \"true\" : \"false\") . \"\\n\";\n    echo \"str_starts_with_compat: \" . (str_starts_with_compat($text, \"PHP\") ? \"true\" : \"false\") . \"\\n\";\n    echo \"str_ends_with_compat: \" . (str_ends_with_compat($text, \"\u3067\u3059\") ? \"true\" : \"false\") . \"\\n\";\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-121\">\u5b9f\u884c\u74b0\u5883\u5225\u306e\u52d5\u4f5c\u306e\u9055\u3044\u3068\u6ce8\u610f\u70b9<\/h3>\n\n\n\n<p>PHP\u30d0\u30fc\u30b8\u30e7\u30f3\u3084\u5b9f\u884c\u74b0\u5883\u306b\u3088\u3063\u3066\u3001\u6587\u5b57\u5217\u691c\u7d22\u306e\u52d5\u4f5c\u304c\u7570\u306a\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u306b\u4e3b\u306a\u6ce8\u610f\u70b9\u3092\u307e\u3068\u3081\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-122\">PHP \u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u3088\u308b\u9055\u3044<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>PHP 8.0\u4ee5\u964d\u306e\u65b0\u95a2\u6570<\/strong>\n<ul class=\"wp-block-list\">\n<li><code>str_contains()<\/code>, <code>str_starts_with()<\/code>, <code>str_ends_with()<\/code>\u306fPHP 8.0\u4ee5\u964d\u3067\u306e\u307f\u4f7f\u7528\u53ef\u80fd<\/li>\n\n\n\n<li>\u3053\u308c\u3089\u306e\u95a2\u6570\u3092\u4f7f\u7528\u3057\u305f\u30b3\u30fc\u30c9\u3092\u53e4\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u5b9f\u884c\u3059\u308b\u3068\u30a8\u30e9\u30fc\u306b\u306a\u308b<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>PHP 7.4\u4ee5\u524d\u306e\u4ee3\u66ff\u5b9f\u88c5<\/strong><ul><li>PHP 7.4\u4ee5\u524d\u3067\u306f\u3001\u524d\u8ff0\u306e\u4e92\u63db\u6027\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b\u304b\u3001\u5f93\u6765\u306e\u65b9\u6cd5\u3067\u540c\u7b49\u306e\u6a5f\u80fd\u3092\u5b9f\u73fe\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b<\/li><\/ul><code>\/\/ PHP 7.4\u4ee5\u524d\u3067\u306e str_contains \u76f8\u5f53 $contains = strpos($haystack, $needle) !== false; \/\/ PHP 7.4\u4ee5\u524d\u3067\u306e str_starts_with \u76f8\u5f53 $starts_with = strpos($haystack, $needle) === 0; \/\/ PHP 7.4\u4ee5\u524d\u3067\u306e str_ends_with \u76f8\u5f53 $ends_with = substr($haystack, -strlen($needle)) === $needle;<\/code><\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-123\">\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u5bfe\u5fdc\u306e\u6ce8\u610f\u70b9<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><em>mb_ \u95a2\u6570\u306e\u8a2d\u5b9a<\/em>*<ul><li>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u6271\u3046\u5834\u5408\u306f\u3001\u9069\u5207\u306a\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u8a2d\u5b9a\u304c\u91cd\u8981<\/li><\/ul><code>\/\/ \u30b9\u30af\u30ea\u30d7\u30c8\u5168\u4f53\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u8a2d\u5b9a mb_internal_encoding('UTF-8'); \/\/ \u307e\u305f\u306f\u95a2\u6570\u547c\u3073\u51fa\u3057\u6642\u306b\u660e\u793a\u7684\u306b\u6307\u5b9a $pos = mb_strpos($text, $needle, 0, 'UTF-8');<\/code><\/li>\n\n\n\n<li><strong>\u30df\u30c3\u30af\u30b9\u30c8\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u306e\u554f\u984c<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u8907\u6570\u306e\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u304c\u6df7\u5728\u3059\u308b\u3068\u4e88\u671f\u3057\u306a\u3044\u52d5\u4f5c\u3092\u5f15\u304d\u8d77\u3053\u3059\u53ef\u80fd\u6027\u304c\u3042\u308b<\/li>\n\n\n\n<li>\u5165\u529b\u30c7\u30fc\u30bf\u306e\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u7d71\u4e00\u3059\u308b\u3053\u3068\u304c\u91cd\u8981<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-124\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306b\u95a2\u3059\u308b\u8003\u616e\u4e8b\u9805<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u95a2\u6570\u9078\u629e\u306e\u30a4\u30f3\u30d1\u30af\u30c8<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u5358\u7d14\u306a\u691c\u7d22\u3067\u306f <code>strpos()<\/code> \u304c\u6700\u3082\u9ad8\u901f<\/li>\n\n\n\n<li>\u6b63\u898f\u8868\u73fe\u306f\u67d4\u8edf\u3060\u304c\u3001\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9\u304c\u5927\u304d\u3044<\/li>\n\n\n\n<li>\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u51e6\u7406\u3067\u306f\u95a2\u6570\u9078\u629e\u304c\u5927\u304d\u306a\u5f71\u97ff\u3092\u4e0e\u3048\u308b<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u5927\u304d\u306a\u30d5\u30a1\u30a4\u30eb\u51e6\u7406\u306e\u6700\u9069\u5316<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u5927\u304d\u306a\u30d5\u30a1\u30a4\u30eb\u306f\u4e00\u5ea6\u306b\u8aad\u307f\u8fbc\u307e\u305a\u3001\u30b9\u30c8\u30ea\u30fc\u30e0\u51e6\u7406\u3084\u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u3092\u4f7f\u7528<\/li>\n\n\n\n<li>\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u304c\u91cd\u8981\u306a\u5834\u5408\u306f\u3001\u30c1\u30e3\u30f3\u30af\u5358\u4f4d\u306e\u51e6\u7406\u3092\u691c\u8a0e<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u30ad\u30e3\u30c3\u30b7\u30e5\u6226\u7565<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u540c\u3058\u30d1\u30bf\u30fc\u30f3\u3067\u306e\u7e70\u308a\u8fd4\u3057\u691c\u7d22\u306f\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u691c\u8a0e<\/li>\n\n\n\n<li>\u30b3\u30b9\u30c8\u306e\u9ad8\u3044\u6b63\u898f\u8868\u73fe\u51e6\u7406\u306f\u7279\u306b\u30ad\u30e3\u30c3\u30b7\u30f3\u30b0\u306e\u6069\u6075\u304c\u5927\u304d\u3044<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p>\u4e0a\u8a18\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3068\u30ac\u30a4\u30c9\u30e9\u30a4\u30f3\u3092\u53c2\u8003\u306b\u3001\u5b9f\u969b\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u6700\u9069\u306a\u6587\u5b57\u5217\u691c\u7d22\u5b9f\u88c5\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u74b0\u5883\u3084\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u306b\u5fdc\u3058\u3066\u3001\u9069\u5207\u306a\u95a2\u6570\u3068\u30a2\u30d7\u30ed\u30fc\u30c1\u3092\u4f7f\u3044\u5206\u3051\u308b\u3053\u3068\u304c\u3001\u52b9\u7387\u7684\u306aPHP\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306e\u9375\u3068\u306a\u308a\u307e\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-3715","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\/3715","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=3715"}],"version-history":[{"count":1,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts\/3715\/revisions"}],"predecessor-version":[{"id":3716,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts\/3715\/revisions\/3716"}],"wp:attachment":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3715"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3715"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3715"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}