{"id":3427,"date":"2025-03-24T08:46:13","date_gmt":"2025-03-23T23:46:13","guid":{"rendered":"https:\/\/dexall.co.jp\/articles\/?p=3427"},"modified":"2025-03-24T08:46:43","modified_gmt":"2025-03-23T23:46:43","slug":"php-strpos-%e5%ae%8c%e5%85%a8%e3%82%ac%e3%82%a4%e3%83%89-9%e3%81%a4%e3%81%ae%e5%ae%9f%e7%94%a8%e4%be%8b%e3%81%a8%e7%9f%a5%e3%81%a3%e3%81%a6%e3%81%8a%e3%81%8f%e3%81%b9%e3%81%8d%e6%b3%a8%e6%84%8f","status":"publish","type":"post","link":"https:\/\/dexall.co.jp\/articles\/?p=3427","title":{"rendered":"PHP strpos() \u5b8c\u5168\u30ac\u30a4\u30c9: 9\u3064\u306e\u5b9f\u7528\u4f8b\u3068\u77e5\u3063\u3066\u304a\u304f\u3079\u304d\u6ce8\u610f\u70b9"},"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\">\u30a4\u30f3\u30c8\u30ed\u30c0\u30af\u30b7\u30e7\u30f3<\/a>  <\/li>  <li>    <a href=\"#i-1\">PHP strpos()\u95a2\u6570\u306e\u57fa\u672c\u3092\u7406\u89e3\u3059\u308b<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-2\">strpos()\u95a2\u6570\u306e\u6b63\u78ba\u306a\u5b9a\u7fa9\u3068\u5f79\u5272<\/a>      <\/li>      <li>        <a href=\"#i-3\">\u95a2\u6570\u306e\u30b7\u30f3\u30bf\u30c3\u30af\u30b9\u3068\u5404\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u8a73\u7d30\u89e3\u8aac<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-4\">\u623b\u308a\u5024\u306e\u7406\u89e3\u3068\u6b63\u3057\u3044\u89e3\u91c8\u65b9\u6cd5<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-5\">PHP strpos()\u306e\u6b63\u3057\u3044\u4f7f\u3044\u65b9\u3068\u5b9f\u88c5\u4f8b<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-6\">\u57fa\u672c\u7684\u306a\u6587\u5b57\u5217\u691c\u7d22\u306e\u5b9f\u88c5\u65b9\u6cd5<\/a>      <\/li>      <li>        <a href=\"#i-7\">\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22\u306e\u5b9f\u73fe\u30c6\u30af\u30cb\u30c3\u30af<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-10\">\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\uff08\u65e5\u672c\u8a9e\u306a\u3069\uff09\u3067\u306e\u6b63\u78ba\u306a\u4f4d\u7f6e\u691c\u51fa\u65b9\u6cd5<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-11\">PHP strpos()\u95a2\u6570\u4f7f\u7528\u6642\u306e\u6ce8\u610f\u70b9\u3068\u843d\u3068\u3057\u7a74<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-12\">\u623b\u308a\u5024\u304c\u300c0\u300d\u3068\u300cfalse\u300d\u306e\u6df7\u540c\u30c8\u30e9\u30d6\u30eb\u3092\u56de\u907f\u3059\u308b\u65b9\u6cd5<\/a>      <\/li>      <li>        <a href=\"#i-15\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u8003\u616e\u3057\u305fstrpos()\u306e\u52b9\u7387\u7684\u306a\u4f7f\u7528\u6cd5<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-17\">\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u89b3\u70b9\u304b\u3089\u307f\u305fstrpos()\u306e\u5b89\u5168\u306a\u5b9f\u88c5\u65b9\u6cd5<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-19\">9\u3064\u306e\u5b9f\u7528\u7684\u306aPHP strpos()\u6d3b\u7528\u30b7\u30fc\u30f3<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-20\">\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u306e\u691c\u8a3c\u3068\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u5b9f\u88c5\u4f8b<\/a>      <\/li>      <li>        <a href=\"#i-21\">URL\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u89e3\u6790\u3068\u62bd\u51fa\u30c6\u30af\u30cb\u30c3\u30af<\/a>      <\/li>      <li>        <a href=\"#i-22\">CSV\/JSON\u30c7\u30fc\u30bf\u5185\u306e\u7279\u5b9a\u6587\u5b57\u5217\u691c\u7d22\u5b9f\u88c5\u6cd5<\/a>      <\/li>      <li>        <a href=\"#i-23\">\u7279\u5b9a\u306e\u5358\u8a9e\u3084\u30d5\u30ec\u30fc\u30ba\u306e\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u6a5f\u80fd\u5b9f\u88c5<\/a>      <\/li>      <li>        <a href=\"#i-24\">HTML\u30bf\u30b0\u306e\u691c\u51fa\u3068\u51e6\u7406\u306e\u5b9f\u88c5\u4f8b<\/a>      <\/li>      <li>        <a href=\"#i-25\">\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u89e3\u6790\u3067\u306e\u6d3b\u7528\u65b9\u6cd5<\/a>      <\/li>      <li>        <a href=\"#i-26\">\u6587\u5b57\u5217\u306e\u7f6e\u63db\u524d\u306e\u6761\u4ef6\u30c1\u30a7\u30c3\u30af\u3067\u306e\u4f7f\u7528\u6cd5<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-27\">API\u30ec\u30b9\u30dd\u30f3\u30b9\u30c7\u30fc\u30bf\u306e\u30d1\u30fc\u30b9\u51e6\u7406\u3067\u306e\u6d3b\u7528\u4f8b<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-28\">PHP strpos()\u3068\u95a2\u9023\u95a2\u6570\u306e\u6bd4\u8f03\u3068\u4f7f\u3044\u5206\u3051<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-29\">stripos()\u3068\u306e\u9055\u3044\u3068\u6700\u9069\u306a\u9078\u629e\u57fa\u6e96<\/a>      <\/li>      <li>        <a href=\"#i-33\">strstr()\u30fbsubstr()\u3068\u306e\u6a5f\u80fd\u6bd4\u8f03\u3068\u7d44\u307f\u5408\u308f\u305b\u6d3b\u7528\u6cd5<\/a>      <\/li>      <li>        <a href=\"#i-38\">preg_match()\u3068\u306e\u4f7f\u3044\u5206\u3051\u30b7\u30ca\u30ea\u30aa\u3068\u5224\u65ad\u57fa\u6e96<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-43\">\u5b9f\u7528\u7684\u306a\u9078\u629e\u30ac\u30a4\u30c9<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-44\">PHP strpos()\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316\u30c6\u30af\u30cb\u30c3\u30af<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-45\">\u5927\u91cf\u30c6\u30ad\u30b9\u30c8\u51e6\u7406\u3067\u306e\u5b9f\u884c\u901f\u5ea6\u3092\u5411\u4e0a\u3055\u305b\u308b\u65b9\u6cd5<\/a>      <\/li>      <li>        <a href=\"#i-49\">\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3092\u6291\u3048\u305f\u52b9\u7387\u7684\u306a\u5b9f\u88c5\u30a2\u30d7\u30ed\u30fc\u30c1<\/a>      <\/li>      <li>        <a href=\"#i-53\">\u51e6\u7406\u901f\u5ea6\u3092\u6bd4\u8f03\u3057\u305f\u5b9f\u6e2c\u30c7\u30fc\u30bf\u3068\u5206\u6790\u7d50\u679c<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-57\">\u6700\u9069\u5316\u306e\u307e\u3068\u3081\u3068\u5b9f\u8df5\u7684\u306a\u30d2\u30f3\u30c8<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-58\">PHP8\u3067\u306estrpos()\u95a2\u6570\u306e\u5909\u66f4\u70b9\u3068\u65b0\u6a5f\u80fd<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-59\">PHP8\u306b\u304a\u3051\u308b\u4ed5\u69d8\u5909\u66f4\u3068\u4e92\u63db\u6027\u306b\u95a2\u3059\u308b\u6ce8\u610f\u70b9<\/a>      <\/li>      <li>        <a href=\"#i-63\">\u65b0\u3057\u3044\u95a2\u9023\u6a5f\u80fd\u3068\u7d44\u307f\u5408\u308f\u305b\u305f\u6700\u65b0\u6d3b\u7528\u6cd5<\/a>      <\/li>      <li>        <a href=\"#i-69\">\u30ec\u30ac\u30b7\u30fc\u30b3\u30fc\u30c9\u306e\u5b89\u5168\u306a\u79fb\u884c\u3068\u30ea\u30d5\u30a1\u30af\u30bf\u30ea\u30f3\u30b0\u65b9\u6cd5<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-74\">\u307e\u3068\u3081\u3068\u63a8\u5968\u3055\u308c\u308b\u5b9f\u88c5\u65b9\u91dd<\/a>      <\/li>    <\/ul>  <\/li>  <li class=\"last\">    <a href=\"#i-76\">\u307e\u3068\u3081\uff1aPHP strpos()\u95a2\u6570\u3092\u30de\u30b9\u30bf\u30fc\u3059\u308b\u305f\u3081\u306e\u91cd\u8981\u30dd\u30a4\u30f3\u30c8<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-77\">\u3053\u306e\u8a18\u4e8b\u3067\u5b66\u3093\u30609\u3064\u306e\u5b9f\u7528\u4f8b\u306e\u632f\u308a\u8fd4\u308a<\/a>      <\/li>      <li>        <a href=\"#i-78\">\u52b9\u679c\u7684\u306a\u6d3b\u7528\u306e\u305f\u3081\u306e5\u3064\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/a>      <\/li>      <li>        <a href=\"#i-79\">\u3055\u3089\u306a\u308b\u30b9\u30ad\u30eb\u30a2\u30c3\u30d7\u306e\u305f\u3081\u306e\u5b66\u7fd2\u30ea\u30bd\u30fc\u30b9\u3068\u53c2\u8003\u60c5\u5831<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-80\">\u307e\u3068\u3081\u306e\u91cd\u8981\u30dd\u30a4\u30f3\u30c8<\/a>      <\/li>    <\/ul>  <\/li><\/ul>\n      <a href=\"#\" class=\"sgb-toc-button js-toc-button\" rel=\"nofollow\" data-open-dialog=\"true\"><i class=\"fa fa-list\"><\/i><span class=\"sgb-toc-button__text\">\u76ee\u6b21\u3078<\/span><\/a>\n    <\/div><\/div><h2 class=\"wp-block-heading\" id=\"i-0\">\u30a4\u30f3\u30c8\u30ed\u30c0\u30af\u30b7\u30e7\u30f3<\/h2>\n\n\n\n<p>PHP\u306b\u3088\u308bWeb\u958b\u767a\u306b\u304a\u3044\u3066\u3001\u6587\u5b57\u5217\u64cd\u4f5c\u306f\u65e5\u5e38\u7684\u306b\u884c\u308f\u308c\u308b\u91cd\u8981\u306a\u51e6\u7406\u306e\u4e00\u3064\u3067\u3059\u3002\u305d\u306e\u4e2d\u3067\u3082<code>strpos()<\/code>\u95a2\u6570\u306f\u3001\u6587\u5b57\u5217\u5185\u3067\u306e\u7279\u5b9a\u306e\u6587\u5b57\u5217\u306e\u4f4d\u7f6e\u3092\u691c\u7d22\u3059\u308b\u305f\u3081\u306e\u57fa\u672c\u7684\u304b\u3064\u5f37\u529b\u306a\u30c4\u30fc\u30eb\u3068\u3057\u3066\u3001\u591a\u304f\u306e\u958b\u767a\u8005\u306b\u5229\u7528\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u4e00\u898b\u30b7\u30f3\u30d7\u30eb\u306b\u898b\u3048\u308b\u3053\u306e\u95a2\u6570\u3067\u3059\u304c\u3001\u6b63\u3057\u304f\u7406\u89e3\u3057\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u69d8\u3005\u306a\u5b9f\u88c5\u30b7\u30fc\u30f3\u3067\u5927\u304d\u306a\u529b\u3092\u767a\u63ee\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><code>strpos()<\/code>\u95a2\u6570\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u306e\u691c\u8a3c\u3001\u30c7\u30fc\u30bf\u51e6\u7406\u3001\u6761\u4ef6\u5206\u5c90\u3001\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u306a\u3069\u3001\u5b9f\u52d9\u306e\u69d8\u3005\u306a\u5834\u9762\u3067\u6d3b\u8e8d\u3057\u307e\u3059\u3002\u3057\u304b\u3057\u3001\u305d\u306e\u4f7f\u7528\u65b9\u6cd5\u3092\u8aa4\u308b\u3068\u3001\u601d\u308f\u306c\u30d0\u30b0\u3084\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u4e0a\u306e\u554f\u984c\u3092\u5f15\u304d\u8d77\u3053\u3059\u53ef\u80fd\u6027\u3082\u3042\u308a\u307e\u3059\u3002\u7279\u306b\u623b\u308a\u5024\u306e\u89e3\u91c8\u3084\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u9762\u3067\u306e\u8003\u616e\u306a\u3069\u3001\u5b9f\u969b\u306b\u4f7f\u7528\u3059\u308b\u969b\u306b\u306f\u6ce8\u610f\u3059\u3079\u304d\u70b9\u304c\u8907\u6570\u5b58\u5728\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u4ee5\u4e0b\u306e\u3053\u3068\u3092\u5b66\u3076\u3053\u3068\u304c\u3067\u304d\u307e\u3059\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>strpos()<\/code>\u95a2\u6570\u306e\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\u3068\u6b63\u78ba\u306a\u7406\u89e3<\/li>\n\n\n\n<li>\u623b\u308a\u5024\u3092\u6b63\u3057\u304f\u89e3\u91c8\u3059\u308b\u305f\u3081\u306e\u91cd\u8981\u306a\u30c6\u30af\u30cb\u30c3\u30af<\/li>\n\n\n\n<li>\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22\u3084\u65e5\u672c\u8a9e\u306a\u3069\u306e\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u6271\u3046\u65b9\u6cd5<\/li>\n\n\n\n<li>0\u3068false\u306e\u6df7\u540c\u306b\u3088\u308b\u4e00\u822c\u7684\u306a\u30d0\u30b0\u306e\u56de\u907f\u6cd5<\/li>\n\n\n\n<li>\u5b9f\u52d9\u3067\u5f79\u7acb\u30649\u3064\u306e\u5177\u4f53\u7684\u306a\u5b9f\u88c5\u4f8b<\/li>\n\n\n\n<li>\u95a2\u9023\u3059\u308b\u6587\u5b57\u5217\u64cd\u4f5c\u95a2\u6570\u3068\u306e\u9055\u3044\u3068\u9069\u5207\u306a\u4f7f\u3044\u5206\u3051<\/li>\n\n\n\n<li>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u6700\u9069\u5316\u3059\u308b\u305f\u3081\u306e\u5b9f\u8df5\u7684\u306a\u30c6\u30af\u30cb\u30c3\u30af<\/li>\n\n\n\n<li>PHP8\u3067\u306e\u5909\u66f4\u70b9\u3068\u65b0\u6a5f\u80fd<\/li>\n<\/ul>\n\n\n\n<p>\u3053\u306e\u5b8c\u5168\u30ac\u30a4\u30c9\u3092\u901a\u3058\u3066\u3001\u5358\u306b<code>strpos()<\/code>\u306e\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\u3092\u5b66\u3076\u3060\u3051\u3067\u306a\u304f\u3001\u5b9f\u969b\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u906d\u9047\u3059\u308b\u69d8\u3005\u306a\u30b7\u30ca\u30ea\u30aa\u306b\u5bfe\u5fdc\u3067\u304d\u308b\u5fdc\u7528\u529b\u3092\u8eab\u306b\u3064\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u521d\u5fc3\u8005\u304b\u3089\u4e2d\u7d1a\u8005\u307e\u3067\u3001PHP\u3067\u306e\u6587\u5b57\u5217\u64cd\u4f5c\u30b9\u30ad\u30eb\u3092\u5411\u4e0a\u3055\u305b\u305f\u3044\u3059\u3079\u3066\u306e\u958b\u767a\u8005\u306b\u3068\u3063\u3066\u4fa1\u5024\u3042\u308b\u5185\u5bb9\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u305d\u308c\u3067\u306f\u3001PHP\u306e\u6587\u5b57\u5217\u64cd\u4f5c\u306e\u8981\u3068\u306a\u308b<code>strpos()<\/code>\u95a2\u6570\u306e\u4e16\u754c\u3092\u8a73\u3057\u304f\u63a2\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-1\">PHP strpos()\u95a2\u6570\u306e\u57fa\u672c\u3092\u7406\u89e3\u3059\u308b<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-2\">strpos()\u95a2\u6570\u306e\u6b63\u78ba\u306a\u5b9a\u7fa9\u3068\u5f79\u5272<\/h3>\n\n\n\n<p><code>strpos()<\/code>\u95a2\u6570\u306f\u3001PHP\u8a00\u8a9e\u306b\u304a\u3051\u308b\u6587\u5b57\u5217\u64cd\u4f5c\u306e\u57fa\u672c\u7684\u306a\u95a2\u6570\u306e\u4e00\u3064\u3067\u3001\u300cstring position\uff08\u6587\u5b57\u5217\u306e\u4f4d\u7f6e\uff09\u300d\u306e\u7565\u79f0\u3067\u3059\u3002\u3053\u306e\u95a2\u6570\u306e\u4e3b\u306a\u5f79\u5272\u306f\u3001\u3042\u308b\u6587\u5b57\u5217\u306e\u4e2d\u304b\u3089\u7279\u5b9a\u306e\u6587\u5b57\u5217\uff08\u90e8\u5206\u6587\u5b57\u5217\uff09\u3092\u691c\u7d22\u3057\u3001\u305d\u306e\u4f4d\u7f6e\u3092\u7279\u5b9a\u3059\u308b\u3053\u3068\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u5177\u4f53\u7684\u306b\u306f\u3001\u300chaystack\uff08\u5e72\u3057\u8349\u306e\u5c71\uff09\u300d\u3068\u547c\u3070\u308c\u308b\u6587\u5b57\u5217\u306e\u4e2d\u304b\u3089\u3001\u300cneedle\uff08\u91dd\uff09\u300d\u3068\u547c\u3070\u308c\u308b\u691c\u7d22\u6587\u5b57\u5217\u304c\u6700\u521d\u306b\u73fe\u308c\u308b\u4f4d\u7f6e\uff08\u30aa\u30d5\u30bb\u30c3\u30c8\uff09\u3092\u898b\u3064\u3051\u51fa\u3057\u307e\u3059\u3002\u3053\u306e\u6bd4\u55a9\u306f\u3001\u300c\u5e72\u3057\u8349\u306e\u5c71\u304b\u3089\u91dd\u3092\u898b\u3064\u3051\u308b\u300d\u3068\u3044\u3046\u82f1\u8a9e\u306e\u6163\u7528\u53e5\u306b\u7531\u6765\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u57fa\u672c\u7684\u306a\u4f7f\u7528\u4f8b\n$position = strpos(\"Hello World\", \"World\"); \/\/ $position\u306b\u306f6\u304c\u683c\u7d0d\u3055\u308c\u308b\n<\/pre>\n\n\n\n<p>\u3053\u306e\u95a2\u6570\u306f\u6b21\u306e\u3088\u3046\u306a\u5834\u9762\u3067\u7279\u306b\u5f79\u7acb\u3061\u307e\u3059\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u7279\u5b9a\u306e\u6587\u5b57\u5217\u304c\u5b58\u5728\u3059\u308b\u304b\u3069\u3046\u304b\u306e\u5224\u5b9a<\/li>\n\n\n\n<li>\u6587\u5b57\u5217\u5185\u306e\u7279\u5b9a\u306e\u90e8\u5206\u3092\u5207\u308a\u51fa\u3059\u524d\u306e\u4f4d\u7f6e\u7279\u5b9a<\/li>\n\n\n\n<li>\u30c6\u30ad\u30b9\u30c8\u51e6\u7406\u3084\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u30f3\u30b0\u306e\u4e00\u90e8\u3068\u3057\u3066<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-3\">\u95a2\u6570\u306e\u30b7\u30f3\u30bf\u30c3\u30af\u30b9\u3068\u5404\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u8a73\u7d30\u89e3\u8aac<\/h3>\n\n\n\n<p><code>strpos()<\/code>\u95a2\u6570\u306e\u6b63\u5f0f\u306a\u30b7\u30f3\u30bf\u30c3\u30af\u30b9\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">int|false strpos(string $haystack, string $needle, int $offset = 0)\n<\/pre>\n\n\n\n<p>\u5404\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u8a73\u7d30\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>$haystack<\/strong>\uff08\u5fc5\u9808\uff09\n<ul class=\"wp-block-list\">\n<li>\u691c\u7d22\u5bfe\u8c61\u3068\u306a\u308b\u6587\u5b57\u5217\uff08\u5e72\u3057\u8349\u306e\u5c71\uff09<\/li>\n\n\n\n<li>\u3053\u306e\u4e2d\u304b\u3089$needle\u3092\u63a2\u3059<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>$needle<\/strong>\uff08\u5fc5\u9808\uff09\n<ul class=\"wp-block-list\">\n<li>\u691c\u7d22\u3059\u308b\u6587\u5b57\u5217\uff08\u91dd\uff09<\/li>\n\n\n\n<li>PHP 8.0\u4ee5\u964d: \u6587\u5b57\u5217\u578b\u306e\u307f\u53d7\u3051\u4ed8\u3051\u3001\u4ed6\u306e\u578b\u306e\u5834\u5408\u306f\u8b66\u544a\u304c\u767a\u751f<\/li>\n\n\n\n<li>PHP 7.3\u4ee5\u524d: \u6587\u5b57\u5217\u4ee5\u5916\u306e\u578b\u304c\u6e21\u3055\u308c\u305f\u5834\u5408\u306f\u6570\u5024\u306b\u5909\u63db\u3055\u308c\u3001\u5bfe\u5fdc\u3059\u308bASCII\u6587\u5b57\u3068\u3057\u3066\u51e6\u7406<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>$offset<\/strong>\uff08\u30aa\u30d7\u30b7\u30e7\u30f3\uff09\n<ul class=\"wp-block-list\">\n<li>\u691c\u7d22\u3092\u958b\u59cb\u3059\u308b\u4f4d\u7f6e\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306f0\uff09<\/li>\n\n\n\n<li>\u6b63\u306e\u5024: \u6587\u5b57\u5217\u306e\u5148\u982d\u304b\u3089\u6307\u5b9a\u3057\u305f\u6587\u5b57\u6570\u5206\u3060\u3051\u30b9\u30ad\u30c3\u30d7\u3057\u3066\u691c\u7d22\u3092\u958b\u59cb<\/li>\n\n\n\n<li>\u8ca0\u306e\u5024: PHP 7.1\u4ee5\u964d\u3067\u306f\u3001\u6587\u5b57\u5217\u306e\u672b\u5c3e\u304b\u3089\u306e\u30aa\u30d5\u30bb\u30c3\u30c8\u3068\u3057\u3066\u6271\u308f\u308c\u308b<\/li>\n<\/ul>\n<\/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=\"\">\/\/ offset\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u4f7f\u7528\u4f8b\n$text = \"Hello World, Hello PHP\";\n$position1 = strpos($text, \"Hello\", 0);    \/\/ $position1\u306f0\uff08\u5148\u982d\u304b\u3089\u691c\u7d22\uff09\n$position2 = strpos($text, \"Hello\", 7);    \/\/ $position2\u306f13\uff087\u6587\u5b57\u76ee\u304b\u3089\u691c\u7d22\u958b\u59cb\uff09\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-4\">\u623b\u308a\u5024\u306e\u7406\u89e3\u3068\u6b63\u3057\u3044\u89e3\u91c8\u65b9\u6cd5<\/h3>\n\n\n\n<p><code>strpos()<\/code>\u306e\u623b\u308a\u5024\u306f\u4ee5\u4e0b\u306e2\u7a2e\u985e\u3067\u3059\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u6574\u6570\u5024\uff08int\uff09<\/strong>: \u6587\u5b57\u5217\u304c\u898b\u3064\u304b\u3063\u305f\u5834\u5408\u3001\u6700\u521d\u306b\u51fa\u73fe\u3059\u308b\u4f4d\u7f6e\uff080\u304b\u3089\u59cb\u307e\u308b\uff09<\/li>\n\n\n\n<li><strong>false<\/strong>: \u6587\u5b57\u5217\u304c\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u5834\u5408<\/li>\n<\/ol>\n\n\n\n<p>\u3053\u3053\u3067\u975e\u5e38\u306b\u91cd\u8981\u306a\u6ce8\u610f\u70b9\u304c\u3042\u308a\u307e\u3059\u3002PHP \u3067\u306f\u6587\u5b57\u5217\u306e\u5148\u982d\u4f4d\u7f6e\u306f0\u304b\u3089\u59cb\u307e\u308a\u307e\u3059\u3002\u305d\u306e\u305f\u3081\u3001\u691c\u7d22\u6587\u5b57\u5217\u304c\u5bfe\u8c61\u6587\u5b57\u5217\u306e\u5148\u982d\u306b\u898b\u3064\u304b\u3063\u305f\u5834\u5408\u3001\u623b\u308a\u5024\u306f0\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$result = strpos(\"Hello World\", \"Hello\"); \/\/ $result\u306f0\uff08\u5148\u982d\u306b\u898b\u3064\u304b\u3063\u305f\uff09\n<\/pre>\n\n\n\n<p>\u3053\u306e\u4ed5\u69d8\u304c\u3001\u591a\u304f\u306e\u521d\u5fc3\u8005\u304c\u9665\u308a\u3084\u3059\u3044\u843d\u3068\u3057\u7a74\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002\u306a\u305c\u306a\u3089\u3001PHP\u3067\u306f0\u306f\u6761\u4ef6\u5f0f\u3067false\u3068\u3057\u3066\u8a55\u4fa1\u3055\u308c\u308b\u305f\u3081\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u306f\u610f\u56f3\u3057\u305f\u901a\u308a\u306b\u52d5\u4f5c\u3057\u307e\u305b\u3093\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=\"\">\/\/ \u8aa4\u3063\u305f\u4f7f\u7528\u4f8b\uff08\u30d0\u30b0\u306e\u539f\u56e0\uff09\nif (strpos($text, \"Hello\")) {\n    echo \"\u898b\u3064\u304b\u308a\u307e\u3057\u305f\"; \/\/ \"Hello\"\u304c\u5148\u982d\u306b\u3042\u308b\u5834\u5408\u3001\u3053\u306e\u884c\u306f\u5b9f\u884c\u3055\u308c\u306a\u3044\n} else {\n    echo \"\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\"; \/\/ \u8aa4\u3063\u3066\u300c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u300d\u3068\u8868\u793a\u3055\u308c\u308b\n}\n\n\/\/ \u6b63\u3057\u3044\u4f7f\u7528\u4f8b\nif (strpos($text, \"Hello\") !== false) {\n    echo \"\u898b\u3064\u304b\u308a\u307e\u3057\u305f\"; \/\/ \u53b3\u5bc6\u306a\u6bd4\u8f03\u3067\u6b63\u3057\u304f\u5224\u5b9a\n} else {\n    echo \"\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\";\n}\n<\/pre>\n\n\n\n<p>\u4e0a\u8a18\u306e\u4f8b\u306e\u3088\u3046\u306b\u3001<code>strpos()<\/code>\u306e\u7d50\u679c\u3092\u6761\u4ef6\u5f0f\u3067\u4f7f\u7528\u3059\u308b\u5834\u5408\u306f\u3001\u5fc5\u305a\u53b3\u5bc6\u306a\u6bd4\u8f03\u6f14\u7b97\u5b50\uff08<code>!==<\/code>\uff09\u3092\u4f7f\u3063\u3066<code>false<\/code>\u3068\u6bd4\u8f03\u3059\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u30010\uff08\u5148\u982d\u306b\u898b\u3064\u304b\u3063\u305f\uff09\u3068false\uff08\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\uff09\u3092\u6b63\u78ba\u306b\u533a\u5225\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-5\">PHP strpos()\u306e\u6b63\u3057\u3044\u4f7f\u3044\u65b9\u3068\u5b9f\u88c5\u4f8b<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-6\">\u57fa\u672c\u7684\u306a\u6587\u5b57\u5217\u691c\u7d22\u306e\u5b9f\u88c5\u65b9\u6cd5<\/h3>\n\n\n\n<p><code>strpos()<\/code>\u95a2\u6570\u3092\u4f7f\u3063\u305f\u57fa\u672c\u7684\u306a\u6587\u5b57\u5217\u691c\u7d22\u306f\u3001PHP\u3067\u306e\u6587\u5b57\u5217\u64cd\u4f5c\u306e\u57fa\u790e\u3068\u306a\u308b\u30c6\u30af\u30cb\u30c3\u30af\u3067\u3059\u3002\u4ee5\u4e0b\u306b\u3001\u4e00\u822c\u7684\u306a\u5b9f\u88c5\u30d1\u30bf\u30fc\u30f3\u3068\u305d\u306e\u5fdc\u7528\u4f8b\u3092\u793a\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=\"\">\/\/ \u57fa\u672c\u7684\u306a\u6587\u5b57\u5217\u691c\u7d22\n$text = \"PHP programming is fun and PHP is powerful.\";\n$search = \"PHP\";\n\n\/\/ \u6587\u5b57\u5217\u304c\u5b58\u5728\u3059\u308b\u304b\u78ba\u8a8d\uff08\u91cd\u8981\uff1a\u5fc5\u305a !== false \u3067\u6bd4\u8f03\u3059\u308b\uff09\nif (strpos($text, $search) !== false) {\n    echo \"\u6587\u5b57\u5217\u300c{$search}\u300d\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002\";\n} else {\n    echo \"\u6587\u5b57\u5217\u300c{$search}\u300d\u306f\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002\";\n}\n\/\/ \u51fa\u529b: \u6587\u5b57\u5217\u300cPHP\u300d\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002\n<\/pre>\n\n\n\n<p>\u3055\u3089\u306b\u3001\u691c\u7d22\u7d50\u679c\u306e\u4f4d\u7f6e\u3092\u6d3b\u7528\u3057\u305f\u5fdc\u7528\u4f8b\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u6587\u5b57\u5217\u306e\u4f4d\u7f6e\u3092\u5229\u7528\u3057\u305f\u90e8\u5206\u6587\u5b57\u5217\u306e\u62bd\u51fa\n$text = \"\u540d\u524d: \u5c71\u7530\u592a\u90ce, \u5e74\u9f62: 30\u6b73\";\n$marker = \": \";\n$name_pos = strpos($text, $marker) + strlen($marker); \/\/ \": \"\u306e\u5f8c\u306e\u4f4d\u7f6e\n$comma_pos = strpos($text, \",\", $name_pos); \/\/ \u6b21\u306e\u30ab\u30f3\u30de\u306e\u4f4d\u7f6e\n\n\/\/ \u540d\u524d\u90e8\u5206\u3092\u62bd\u51fa\n$name = substr($text, $name_pos, $comma_pos - $name_pos);\necho \"\u62bd\u51fa\u3055\u308c\u305f\u540d\u524d: \" . $name; \/\/ \u51fa\u529b: \u62bd\u51fa\u3055\u308c\u305f\u540d\u524d: \u5c71\u7530\u592a\u90ce\n\n\/\/ \u5225\u306e\u691c\u7d22: 2\u756a\u76ee\u306e\u51fa\u73fe\u4f4d\u7f6e\u3092\u898b\u3064\u3051\u308b\n$first_pos = strpos($text, $marker); \/\/ \u6700\u521d\u306e\": \"\u306e\u4f4d\u7f6e\n$second_pos = strpos($text, $marker, $first_pos + 1); \/\/ 2\u756a\u76ee\u306e\": \"\u306e\u4f4d\u7f6e\necho \"2\u756a\u76ee\u306e\u300c{$marker}\u300d\u306f{$second_pos}\u6587\u5b57\u76ee\u306b\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002\";\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-7\">\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22\u306e\u5b9f\u73fe\u30c6\u30af\u30cb\u30c3\u30af<\/h3>\n\n\n\n<p>PHP\u3067\u306f\u3001\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u305b\u305a\u306b\u6587\u5b57\u5217\u3092\u691c\u7d22\u3059\u308b\u65b9\u6cd5\u304c\u3044\u304f\u3064\u304b\u5b58\u5728\u3057\u307e\u3059\u3002\u6700\u3082\u4e00\u822c\u7684\u306a\u65b9\u6cd5\u306f\u4ee5\u4e0b\u306e2\u3064\u3067\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-8\">1. stripos()\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b\u65b9\u6cd5<\/h4>\n\n\n\n<p><code>stripos()<\/code>\u306f<code>strpos()<\/code>\u306e\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u3001\u6700\u3082\u52b9\u7387\u7684\u3067\u63a8\u5968\u3055\u308c\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=\"\">\/\/ stripos()\u3092\u4f7f\u3063\u305f\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22\n$text = \"PHP is a powerful language. php is widely used.\";\n$search = \"php\";\n\n\/\/ stripos()\u3067\u306e\u691c\u7d22\uff08\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\uff09\n$position = stripos($text, $search);\necho \"\u300c{$search}\u300d\u306f{$position}\u6587\u5b57\u76ee\u306b\u898b\u3064\u304b\u308a\u307e\u3057\u305f\uff08\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u533a\u5225\u306a\u3057\uff09\u3002\";\n\/\/ \u51fa\u529b: \u300cphp\u300d\u306f0\u6587\u5b57\u76ee\u306b\u898b\u3064\u304b\u308a\u307e\u3057\u305f\uff08\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u533a\u5225\u306a\u3057\uff09\u3002\n\n\/\/ \u6bd4\u8f03\u306e\u305f\u3081\u306estrpos()\uff08\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3059\u308b\uff09\n$position_case_sensitive = strpos($text, $search);\necho \"\u300c{$search}\u300d\u306f{$position_case_sensitive}\u6587\u5b57\u76ee\u306b\u898b\u3064\u304b\u308a\u307e\u3057\u305f\uff08\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u533a\u5225\u3042\u308a\uff09\u3002\";\n\/\/ \u51fa\u529b: \u300cphp\u300d\u306f26\u6587\u5b57\u76ee\u306b\u898b\u3064\u304b\u308a\u307e\u3057\u305f\uff08\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u533a\u5225\u3042\u308a\uff09\u3002\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-9\">2. strtolower()\u3068\u7d44\u307f\u5408\u308f\u305b\u308b\u65b9\u6cd5<\/h4>\n\n\n\n<p>\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u3001\u6587\u5b57\u5217\u3092\u4e8b\u524d\u306b\u5c0f\u6587\u5b57\uff08\u307e\u305f\u306f\u5927\u6587\u5b57\uff09\u306b\u5909\u63db\u3057\u3066\u304b\u3089\u691c\u7d22\u3059\u308b\u3053\u3068\u3082\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=\"\">\/\/ strtolower()\u3092\u4f7f\u3063\u305f\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22\n$text = \"PHP is a powerful language. php is widely used.\";\n$search = \"php\";\n\n\/\/ \u4e21\u65b9\u306e\u6587\u5b57\u5217\u3092\u5c0f\u6587\u5b57\u306b\u5909\u63db\u3057\u3066\u304b\u3089\u691c\u7d22\n$position = strpos(strtolower($text), strtolower($search));\necho \"\u300c{$search}\u300d\u306f{$position}\u6587\u5b57\u76ee\u306b\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002\";\n\/\/ \u51fa\u529b: \u300cphp\u300d\u306f0\u6587\u5b57\u76ee\u306b\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002\n\n\/\/ \u6ce8\u610f: \u3053\u306e\u65b9\u6cd5\u306f\u5927\u304d\u306a\u30c6\u30ad\u30b9\u30c8\u3067\u306f\u975e\u52b9\u7387\u306b\u306a\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\n<\/pre>\n\n\n\n<p>\u4e00\u822c\u7684\u306b\u3001<code>stripos()<\/code>\u306e\u65b9\u304c<code>strtolower()<\/code>\u3068<code>strpos()<\/code>\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u65b9\u6cd5\u3088\u308a\u3082\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u826f\u3044\u305f\u3081\u3001\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22\u304c\u5fc5\u8981\u306a\u5834\u5408\u306f<code>stripos()<\/code>\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3092\u304a\u52e7\u3081\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-10\">\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\uff08\u65e5\u672c\u8a9e\u306a\u3069\uff09\u3067\u306e\u6b63\u78ba\u306a\u4f4d\u7f6e\u691c\u51fa\u65b9\u6cd5<\/h3>\n\n\n\n<p>PHP\u306e\u6a19\u6e96\u6587\u5b57\u5217\u95a2\u6570\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u30b7\u30f3\u30b0\u30eb\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u524d\u63d0\u3068\u3057\u3066\u3044\u307e\u3059\u3002\u305d\u306e\u305f\u3081\u3001\u65e5\u672c\u8a9e\u3084\u305d\u306e\u4ed6\u306e\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\uff08UTF-8\u306a\u3069\uff09\u3092\u6271\u3046\u969b\u306b\u306f\u3001<code>mb_*<\/code>\u95a2\u6570\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=\"\">\/\/ \u65e5\u672c\u8a9e\u6587\u5b57\u5217\u3067\u306e\u691c\u7d22\n$text = \"PHP\u306f\u4eba\u6c17\u306e\u3042\u308b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3067\u3059\u3002PHP\u3067\u30a6\u30a7\u30d6\u958b\u767a\u304c\u3067\u304d\u307e\u3059\u3002\";\n$search = \"\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\";\n\n\/\/ strpos()\u3067\u306e\u691c\u7d22\uff08\u30d0\u30a4\u30c8\u5358\u4f4d\u3067\u4f4d\u7f6e\u3092\u8fd4\u3059\uff09\n$position_byte = strpos($text, $search);\necho \"strpos(): \u300c{$search}\u300d\u306f{$position_byte}\u30d0\u30a4\u30c8\u76ee\u306b\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002\";\n\/\/ \u6ce8: \u3053\u306e\u7d50\u679c\u306f\u30d0\u30a4\u30c8\u5358\u4f4d\u306a\u306e\u3067\u6b63\u78ba\u306a\u6587\u5b57\u6570\u3068\u306f\u7570\u306a\u308b\n\n\/\/ mb_strpos()\u3067\u306e\u691c\u7d22\uff08\u6587\u5b57\u5358\u4f4d\u3067\u4f4d\u7f6e\u3092\u8fd4\u3059\uff09\n$position_char = mb_strpos($text, $search, 0, 'UTF-8');\necho \"mb_strpos(): \u300c{$search}\u300d\u306f{$position_char}\u6587\u5b57\u76ee\u306b\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002\";\n\n\/\/ \u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u5bfe\u5fdc\u3067\u306e\u90e8\u5206\u6587\u5b57\u5217\u306e\u62bd\u51fa\nif ($position_char !== false) {\n    $before = mb_substr($text, 0, $position_char, 'UTF-8');\n    $after = mb_substr($text, $position_char + mb_strlen($search, 'UTF-8'), null, 'UTF-8');\n    echo \"\u300c{$search}\u300d\u306e\u524d: {$before}\";\n    echo \"\u300c{$search}\u300d\u306e\u5f8c: {$after}\";\n}\n<\/pre>\n\n\n\n<p>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u6271\u3046\u969b\u306e\u91cd\u8981\u30dd\u30a4\u30f3\u30c8\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u9069\u5207\u306a\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u306e\u6307\u5b9a<\/strong>: <code>mb_strpos()<\/code>\u306e\u7b2c4\u5f15\u6570\u306b\u306f\u3001\u4f7f\u7528\u3059\u308b\u6587\u5b57\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\uff08\u591a\u304f\u306e\u5834\u5408\u306f\u2019UTF-8\u2019\uff09\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u4e00\u8cab\u6027<\/strong>: \u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u6271\u3046\u5834\u5408\u306f\u3001<code>strpos()<\/code>\u3084<code>substr()<\/code>\u306a\u3069\u306e\u30b7\u30f3\u30b0\u30eb\u30d0\u30a4\u30c8\u95a2\u6570\u3067\u306f\u306a\u304f\u3001\u5e38\u306b<code>mb_strpos()<\/code>\u3084<code>mb_substr()<\/code>\u306a\u3069\u306e\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u95a2\u6570\u3092\u4f7f\u7528\u3057\u307e\u3057\u3087\u3046\u3002<\/li>\n\n\n\n<li><strong>PHP.ini\u306e\u8a2d\u5b9a<\/strong>: \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u5168\u4f53\u3067\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u95a2\u6570\u3092\u983b\u7e41\u306b\u4f7f\u7528\u3059\u308b\u5834\u5408\u306f\u3001<code>php.ini<\/code>\u3067<code>mbstring.internal_encoding<\/code>\u3092\u8a2d\u5b9a\u3059\u308b\u304b\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u5148\u982d\u3067<code>mb_internal_encoding('UTF-8')<\/code>\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3092\u691c\u8a0e\u3057\u3066\u304f\u3060\u3055\u3044\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=\"\">\/\/ \u30b9\u30af\u30ea\u30d7\u30c8\u5148\u982d\u3067\u306e\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u8a2d\u5b9a\u4f8b\nmb_internal_encoding('UTF-8');\nmb_http_output('UTF-8');\n\n\/\/ \u3053\u308c\u4ee5\u964d\u306f\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u7701\u7565\u3067\u304d\u308b\n$position = mb_strpos($japanese_text, $search_word);\n<\/pre>\n\n\n\n<p>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u3092\u6b63\u3057\u304f\u6271\u3046\u3053\u3068\u306f\u3001\u56fd\u969b\u7684\u306a\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3084\u30b7\u30b9\u30c6\u30e0\u3092\u958b\u767a\u3059\u308b\u5834\u5408\u306b\u7279\u306b\u91cd\u8981\u3067\u3059\u3002\u6587\u5b57\u5316\u3051\u3084\u30d0\u30b0\u3092\u9632\u3050\u305f\u3081\u3001\u5e38\u306b\u9069\u5207\u306a\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b\u3088\u3046\u5fc3\u304c\u3051\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-11\">PHP strpos()\u95a2\u6570\u4f7f\u7528\u6642\u306e\u6ce8\u610f\u70b9\u3068\u843d\u3068\u3057\u7a74<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-12\">\u623b\u308a\u5024\u304c\u300c0\u300d\u3068\u300cfalse\u300d\u306e\u6df7\u540c\u30c8\u30e9\u30d6\u30eb\u3092\u56de\u907f\u3059\u308b\u65b9\u6cd5<\/h3>\n\n\n\n<p><code>strpos()<\/code>\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b\u969b\u306e\u6700\u3082\u4e00\u822c\u7684\u306a\u843d\u3068\u3057\u7a74\u306f\u3001\u623b\u308a\u5024\u306e\u300c0\u300d\u3068\u300cfalse\u300d\u306e\u6df7\u540c\u3067\u3059\u3002\u3053\u306e\u554f\u984c\u306f\u521d\u5fc3\u8005\u3060\u3051\u3067\u306a\u304f\u3001\u7d4c\u9a13\u8c4a\u5bcc\u306a\u958b\u767a\u8005\u3082\u6642\u6298\u9665\u308b\u30df\u30b9\u3067\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-13\">\u554f\u984c\u306e\u539f\u56e0<\/h4>\n\n\n\n<p>\u3053\u306e\u6df7\u540c\u304c\u8d77\u3053\u308b\u7406\u7531\u306f\u6b21\u306e2\u70b9\u3067\u3059\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><code>strpos()<\/code>\u306f\u6587\u5b57\u5217\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u5834\u5408\u306b<code>false<\/code>\u3092\u8fd4\u3057\u3001\u898b\u3064\u304b\u3063\u305f\u5834\u5408\u306f\u305d\u306e\u4f4d\u7f6e\uff08\u6574\u6570\uff09\u3092\u8fd4\u3057\u307e\u3059<\/li>\n\n\n\n<li>PHP\u306e\u5f31\u3044\u578b\u4ed8\u3051\u8a00\u8a9e\u3068\u3057\u3066\u306e\u7279\u6027\u306b\u3088\u308a\u3001\u6761\u4ef6\u5f0f\u3067<code>0<\/code>\u306f<code>false<\/code>\u3068\u3057\u3066\u8a55\u4fa1\u3055\u308c\u307e\u3059<\/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=\"\">\/\/ \u5371\u967a\u306a\u30b3\u30fc\u30c9\u4f8b\uff08\u30d0\u30b0\u3042\u308a\uff09\n$text = \"Hello World\";\nif (strpos($text, \"Hello\")) {\n    echo \"\u300cHello\u300d\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\";  \/\/ \u3053\u306e\u884c\u306f\u5b9f\u884c\u3055\u308c\u306a\u3044\uff01\n} else {\n    echo \"\u300cHello\u300d\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\"; \/\/ \u8aa4\u3063\u3066\u5b9f\u884c\u3055\u308c\u308b\n}\n<\/pre>\n\n\n\n<p>\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001<code>\"Hello\"<\/code>\u306f<code>$text<\/code>\u306e\u5148\u982d\uff08\u4f4d\u7f6e0\uff09\u306b\u5b58\u5728\u3059\u308b\u306b\u3082\u304b\u304b\u308f\u3089\u305a\u3001\u6761\u4ef6\u5f0f\u3067<code>0<\/code>\u304c<code>false<\/code>\u3068\u3057\u3066\u8a55\u4fa1\u3055\u308c\u308b\u305f\u3081\u3001\u300c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u300d\u3068\u8aa4\u3063\u3066\u51fa\u529b\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-14\">\u89e3\u6c7a\u7b56<\/h4>\n\n\n\n<p>\u3053\u306e\u554f\u984c\u3092\u56de\u907f\u3059\u308b\u305f\u3081\u306e\u6700\u3082\u78ba\u5b9f\u306a\u65b9\u6cd5\u306f\u3001<strong>\u53b3\u5bc6\u306a\u6bd4\u8f03\u6f14\u7b97\u5b50<\/strong>\uff08<code>===<\/code>\u3084<code>!==<\/code>\uff09\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u6b63\u3057\u3044\u30b3\u30fc\u30c9\u4f8b\n$text = \"Hello World\";\n$position = strpos($text, \"Hello\");\n\nif ($position !== false) {\n    echo \"\u300cHello\u300d\u304c{$position}\u6587\u5b57\u76ee\u306b\u898b\u3064\u304b\u308a\u307e\u3057\u305f\";\n} else {\n    echo \"\u300cHello\u300d\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\";\n}\n<\/pre>\n\n\n\n<p>\u3055\u3089\u306b\u3001\u3088\u308a\u5b89\u5168\u306a\u30d1\u30bf\u30fc\u30f3\u3068\u3057\u3066\u3001\u6b21\u306e\u3088\u3046\u306a\u5b9f\u88c5\u3082\u63a8\u5968\u3055\u308c\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u3088\u308a\u660e\u793a\u7684\u3067\u5b89\u5168\u306a\u30b3\u30fc\u30c9\u4f8b\n$text = \"Hello World\";\n$search = \"Hello\";\n$position = strpos($text, $search);\n\n\/\/ \u578b\u3082\u5024\u3082\u53b3\u5bc6\u306b\u6bd4\u8f03\nif ($position !== false) {\n    echo \"\u300c{$search}\u300d\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\uff08\u4f4d\u7f6e: {$position}\uff09\";\n} else {\n    echo \"\u300c{$search}\u300d\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\";\n}\n\n\/\/ \u307e\u305f\u306f\u4e09\u9805\u6f14\u7b97\u5b50\u3092\u4f7f\u3063\u305f\u7c21\u6f54\u306a\u8868\u73fe\n$result = ($position !== false) \n    ? \"\u300c{$search}\u300d\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\uff08\u4f4d\u7f6e: {$position}\uff09\" \n    : \"\u300c{$search}\u300d\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\";\necho $result;\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-15\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u8003\u616e\u3057\u305fstrpos()\u306e\u52b9\u7387\u7684\u306a\u4f7f\u7528\u6cd5<\/h3>\n\n\n\n<p><code>strpos()<\/code>\u95a2\u6570\u306f\u6bd4\u8f03\u7684\u9ad8\u901f\u3067\u3059\u304c\u3001\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3084\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3092\u884c\u3046\u5834\u5408\u306b\u306f\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u610f\u8b58\u3057\u305f\u4f7f\u3044\u65b9\u304c\u91cd\u8981\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-16\">\u52b9\u7387\u7684\u306a\u4f7f\u7528\u306e\u305f\u3081\u306e\u30c6\u30af\u30cb\u30c3\u30af<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u4e0d\u8981\u306a\u7e70\u308a\u8fd4\u3057\u691c\u7d22\u3092\u907f\u3051\u308b<\/strong><\/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=\"\">\/\/ \u975e\u52b9\u7387\u306a\u5b9f\u88c5\n$text = \"PHP is a versatile language. PHP can be used for web development.\";\nif (strpos($text, \"PHP\") !== false) {\n    \/\/ \u4f55\u304b\u51e6\u7406\n}\nif (strpos($text, \"PHP\") !== false &amp;&amp; strpos($text, \"web\") !== false) {\n    \/\/ \u5225\u306e\u51e6\u7406\n}\n\n\/\/ \u52b9\u7387\u7684\u306a\u5b9f\u88c5\n$php_pos = strpos($text, \"PHP\");\n$web_pos = strpos($text, \"web\");\n\nif ($php_pos !== false) {\n    \/\/ \u4f55\u304b\u51e6\u7406\n}\nif ($php_pos !== false &amp;&amp; $web_pos !== false) {\n    \/\/ \u5225\u306e\u51e6\u7406\n}\n<\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>offset \u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u6d3b\u7528<\/strong><\/li>\n<\/ol>\n\n\n\n<p>\u691c\u7d22\u958b\u59cb\u4f4d\u7f6e\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001\u5927\u304d\u306a\u30c6\u30ad\u30b9\u30c8\u5185\u3067\u8907\u6570\u306e\u51fa\u73fe\u7b87\u6240\u3092\u52b9\u7387\u7684\u306b\u898b\u3064\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u3059\u3079\u3066\u306e\u51fa\u73fe\u4f4d\u7f6e\u3092\u898b\u3064\u3051\u308b\u52b9\u7387\u7684\u306a\u65b9\u6cd5\n$text = \"PHP is great. PHP is powerful. PHP is popular.\";\n$search = \"PHP\";\n$offset = 0;\n$positions = [];\n\nwhile (($pos = strpos($text, $search, $offset)) !== false) {\n    $positions[] = $pos;\n    $offset = $pos + 1; \/\/ \u6b21\u306e\u691c\u7d22\u3092\u73fe\u5728\u306e\u4f4d\u7f6e\u306e\u6b21\u304b\u3089\u958b\u59cb\n}\n\necho \"\u300c{$search}\u300d\u306f \" . count($positions) . \" \u56de\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002\";\necho \"\u4f4d\u7f6e: \" . implode(', ', $positions);\n<\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li><strong>strpos() vs. \u6b63\u898f\u8868\u73fe<\/strong><\/li>\n<\/ol>\n\n\n\n<p>\u5358\u7d14\u306a\u6587\u5b57\u5217\u691c\u7d22\u3067\u306f\u3001<code>strpos()<\/code>\u306f<code>preg_match()<\/code>\u306a\u3069\u306e\u6b63\u898f\u8868\u73fe\u95a2\u6570\u3088\u308a\u3082\u4e00\u822c\u7684\u306b\u9ad8\u901f\u3067\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6bd4\u8f03\u306e\u4f8b\n$text = file_get_contents('large_text_file.txt'); \/\/ \u5927\u304d\u306a\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\n$search = \"specific_word\";\n\n\/\/ strpos()\u3092\u4f7f\u7528\u3057\u305f\u691c\u7d22\uff08\u9ad8\u901f\uff09\n$start_time = microtime(true);\n$result1 = strpos($text, $search) !== false;\n$strpos_time = microtime(true) - $start_time;\n\n\/\/ \u6b63\u898f\u8868\u73fe\u3092\u4f7f\u7528\u3057\u305f\u691c\u7d22\uff08\u3088\u308a\u4f4e\u901f\uff09\n$start_time = microtime(true);\n$result2 = preg_match('\/' . preg_quote($search, '\/') . '\/', $text);\n$preg_time = microtime(true) - $start_time;\n\necho \"strpos() \u5b9f\u884c\u6642\u9593: \" . ($strpos_time * 1000) . \" \u30df\u30ea\u79d2\\n\";\necho \"preg_match() \u5b9f\u884c\u6642\u9593: \" . ($preg_time * 1000) . \" \u30df\u30ea\u79d2\\n\";\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-17\">\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u89b3\u70b9\u304b\u3089\u307f\u305fstrpos()\u306e\u5b89\u5168\u306a\u5b9f\u88c5\u65b9\u6cd5<\/h3>\n\n\n\n<p><code>strpos()<\/code>\u81ea\u4f53\u306f\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30ea\u30b9\u30af\u3092\u76f4\u63a5\u5f15\u304d\u8d77\u3053\u3059\u308f\u3051\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u3001\u7279\u306b\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u3092\u691c\u8a3c\u3059\u308b\u969b\u306b\u4f7f\u7528\u3059\u308b\u5834\u5408\u306f\u3001\u3044\u304f\u3064\u304b\u306e\u6ce8\u610f\u70b9\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-18\">\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3092\u8003\u616e\u3057\u305f\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u306e\u691c\u8a3c<\/strong><\/li>\n<\/ol>\n\n\n\n<p>\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u3092\u305d\u306e\u307e\u307e\u51e6\u7406\u3059\u308b\u3068\u3001\u610f\u56f3\u3057\u306a\u3044\u7d50\u679c\u306b\u306a\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u60aa\u610f\u306e\u3042\u308b\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u306b\u5bfe\u3059\u308b\u8106\u5f31\u306a\u5b9f\u88c5\n$user_input = $_GET['search']; \/\/ \u6f5c\u5728\u7684\u306b\u5371\u967a\nif (strpos($safe_content, $user_input) !== false) {\n    \/\/ \u30e6\u30fc\u30b6\u30fc\u5165\u529b\u304c\u5b89\u5168\u306a\u30b3\u30f3\u30c6\u30f3\u30c4\u306b\u542b\u307e\u308c\u3066\u3044\u308b\u3068\u3044\u3046\u524d\u63d0\n    echo \"\u5165\u529b\u3055\u308c\u305f\u30c6\u30ad\u30b9\u30c8\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\";\n}\n\n\/\/ \u3088\u308a\u5b89\u5168\u306a\u5b9f\u88c5\n$user_input = htmlspecialchars($_GET['search'] ?? '', ENT_QUOTES, 'UTF-8');\n\/\/ \u5165\u529b\u306e\u691c\u8a3c\u3084\u9577\u3055\u306e\u5236\u9650\u306a\u3069\u3001\u8ffd\u52a0\u306e\u30c1\u30a7\u30c3\u30af\u3092\u884c\u3046\nif (!empty($user_input) &amp;&amp; strlen($user_input) &lt;= 100) {\n    if (strpos($safe_content, $user_input) !== false) {\n        echo \"\u5165\u529b\u3055\u308c\u305f\u30c6\u30ad\u30b9\u30c8\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\";\n    }\n}\n<\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>XSS\u5bfe\u7b56\u3068\u3057\u3066\u306e\u4f7f\u7528<\/strong><\/li>\n<\/ol>\n\n\n\n<p><code>strpos()<\/code>\u3092\u4f7f\u3063\u3066HTML\u30bf\u30b0\u306a\u3069\u3092\u691c\u51fa\u3059\u308b\u5834\u5408\u306e\u5b89\u5168\u306a\u65b9\u6cd5\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=\"\">\/\/ XSS\u5bfe\u7b56\u306e\u4f8b\n$user_comment = $_POST['comment'] ?? '';\n\n\/\/ \u5371\u967a\uff1a\u4e0d\u5b8c\u5168\u306a\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\nif (strpos($user_comment, '&lt;script&gt;') === false) {\n    \/\/ \u30b9\u30af\u30ea\u30d7\u30c8\u30bf\u30b0\u304c\u306a\u3044\u304b\u3089\u3068\u3044\u3063\u3066\u5b89\u5168\u3068\u306f\u9650\u3089\u306a\u3044\n    echo $user_comment; \/\/ \u5371\u967a\uff01\n}\n\n\/\/ \u5b89\u5168\uff1a\u9069\u5207\u306a\u30a8\u30b9\u30b1\u30fc\u30d7\u51e6\u7406\n$safe_comment = htmlspecialchars($user_comment, ENT_QUOTES, 'UTF-8');\necho $safe_comment; \/\/ \u5b89\u5168\n<\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li><strong>SQL\u30a4\u30f3\u30b8\u30a7\u30af\u30b7\u30e7\u30f3\u5bfe\u7b56\u3067\u306e\u6ce8\u610f\u70b9<\/strong><\/li>\n<\/ol>\n\n\n\n<p><code>strpos()<\/code>\u3060\u3051\u3067SQL\u30a4\u30f3\u30b8\u30a7\u30af\u30b7\u30e7\u30f3\u3092\u9632\u3050\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\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=\"\">\/\/ \u5371\u967a\uff1a\u4e0d\u5341\u5206\u306aSQL\u30a4\u30f3\u30b8\u30a7\u30af\u30b7\u30e7\u30f3\u5bfe\u7b56\n$user_input = $_GET['username'];\nif (strpos($user_input, \"'\") === false &amp;&amp; strpos($user_input, \"\\\"\") === false) {\n    \/\/ \u30b7\u30f3\u30b0\u30eb\u30af\u30a9\u30fc\u30c8\u3068\u30c0\u30d6\u30eb\u30af\u30a9\u30fc\u30c8\u304c\u306a\u3044\u304b\u3089\u3068\u3044\u3063\u3066\u5b89\u5168\u3068\u306f\u9650\u3089\u306a\u3044\n    $query = \"SELECT * FROM users WHERE username = '$user_input'\"; \/\/ \u5371\u967a\uff01\n}\n\n\/\/ \u5b89\u5168\uff1a\u30d7\u30ea\u30da\u30a2\u30fc\u30c9\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3092\u4f7f\u7528\n$pdo = new PDO(\/* \u63a5\u7d9a\u60c5\u5831 *\/);\n$stmt = $pdo-&gt;prepare(\"SELECT * FROM users WHERE username = ?\");\n$stmt-&gt;execute([$user_input]); \/\/ \u5b89\u5168\n<\/pre>\n\n\n\n<p>\u91cd\u8981\u306a\u6559\u8a13\u3068\u3057\u3066\u3001<code>strpos()<\/code>\u306f\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5bfe\u7b56\u3068\u3057\u3066\u5358\u72ec\u3067\u4f7f\u7528\u3059\u308b\u3079\u304d\u3067\u306f\u306a\u304f\u3001\u9069\u5207\u306a\u30a8\u30b9\u30b1\u30fc\u30d7\u51e6\u7406\u3084\u30d7\u30ea\u30da\u30a2\u30fc\u30c9\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u306a\u3069\u306e\u6a19\u6e96\u7684\u306a\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5bfe\u7b56\u3068\u7d44\u307f\u5408\u308f\u305b\u3066\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u306f\u5358\u4e00\u306e\u95a2\u6570\u3084\u30c6\u30af\u30cb\u30c3\u30af\u3060\u3051\u3067\u306a\u304f\u3001\u8907\u6570\u306e\u9632\u5fa1\u5c64\u3092\u91cd\u306d\u308b\u3053\u3068\u3067\u78ba\u4fdd\u3055\u308c\u308b\u3079\u304d\u3082\u306e\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-19\">9\u3064\u306e\u5b9f\u7528\u7684\u306aPHP strpos()\u6d3b\u7528\u30b7\u30fc\u30f3<\/h2>\n\n\n\n<p><code>strpos()<\/code>\u95a2\u6570\u306f\u5358\u7d14\u306a\u304c\u3089\u975e\u5e38\u306b\u5f37\u529b\u306a\u6a5f\u80fd\u3067\u3001\u5b9f\u52d9\u306e\u69d8\u3005\u306a\u5834\u9762\u3067\u6d3b\u8e8d\u3057\u307e\u3059\u3002\u3053\u3053\u3067\u306f\u3001\u5b9f\u7528\u7684\u306a9\u3064\u306e\u6d3b\u7528\u30b7\u30fc\u30f3\u3068\u305d\u308c\u305e\u308c\u306e\u5b9f\u88c5\u4f8b\u3092\u8a73\u3057\u304f\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-20\">\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u306e\u691c\u8a3c\u3068\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u5b9f\u88c5\u4f8b<\/h3>\n\n\n\n<p>\u30e6\u30fc\u30b6\u30fc\u304b\u3089\u53d7\u3051\u53d6\u3063\u305f\u5165\u529b\u306e\u691c\u8a3c\u306f\u3001Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306b\u304a\u3051\u308b\u57fa\u672c\u7684\u306a\u4f5c\u696d\u3067\u3059\u3002<code>strpos()<\/code>\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u7c21\u5358\u304b\u3064\u52b9\u7387\u7684\u306b\u591a\u304f\u306e\u691c\u8a3c\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306e\u57fa\u672c\u7684\u306a\u691c\u8a3c\nfunction validateEmail($email) {\n    \/\/ @\u8a18\u53f7\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\n    if (strpos($email, '@') === false) {\n        return false;\n    }\n    \n    \/\/ \u30c9\u30e1\u30a4\u30f3\u90e8\u5206\u306b\u30c9\u30c3\u30c8\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\n    $domain = substr($email, strpos($email, '@') + 1);\n    if (strpos($domain, '.') === false) {\n        return false;\n    }\n    \n    return true;\n}\n\n\/\/ \u30d5\u30a9\u30fc\u30e0\u304b\u3089\u53d7\u3051\u53d6\u3063\u305f\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u691c\u8a3c\n$email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL);\nif (!validateEmail($email)) {\n    echo \"\u6709\u52b9\u306a\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002\";\n}\n\n\/\/ \u7981\u6b62\u30ef\u30fc\u30c9\u306e\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\nfunction containsForbiddenWords($text, $forbidden_words) {\n    $text = strtolower($text);\n    foreach ($forbidden_words as $word) {\n        if (strpos($text, strtolower($word)) !== false) {\n            return true; \/\/ \u7981\u6b62\u30ef\u30fc\u30c9\u304c\u898b\u3064\u304b\u3063\u305f\n        }\n    }\n    return false; \/\/ \u7981\u6b62\u30ef\u30fc\u30c9\u306f\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\n}\n\n\/\/ \u30b3\u30e1\u30f3\u30c8\u6295\u7a3f\u306e\u691c\u8a3c\n$comment = $_POST['comment'] ?? '';\n$forbidden_words = ['spam', '\u4e0d\u9069\u5207', 'xxx', '\u7981\u6b62\u8a9e'];\n\nif (containsForbiddenWords($comment, $forbidden_words)) {\n    echo \"\u6295\u7a3f\u306b\u306f\u4e0d\u9069\u5207\u306a\u8868\u73fe\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002\";\n} else {\n    \/\/ \u30b3\u30e1\u30f3\u30c8\u3092\u4fdd\u5b58\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-21\">URL\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u89e3\u6790\u3068\u62bd\u51fa\u30c6\u30af\u30cb\u30c3\u30af<\/h3>\n\n\n\n<p>URL\u306e\u89e3\u6790\u3084\u64cd\u4f5c\u306f\u3001\u7279\u306b\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u51e6\u7406\u3084\u30ea\u30f3\u30af\u751f\u6210\u306b\u304a\u3044\u3066\u3088\u304f\u884c\u308f\u308c\u308b\u4f5c\u696d\u3067\u3059\u3002<code>strpos()<\/code>\u3092\u4f7f\u3048\u3070\u3001URL\u306e\u5404\u90e8\u5206\u3092\u52b9\u7387\u7684\u306b\u62bd\u51fa\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=\"\">\/\/ URL\u304b\u3089\u30c9\u30e1\u30a4\u30f3\u540d\u3092\u62bd\u51fa\nfunction extractDomain($url) {\n    \/\/ \u30d7\u30ed\u30c8\u30b3\u30eb\u90e8\u5206\u3092\u30b9\u30ad\u30c3\u30d7\n    $domain_start = strpos($url, ':\/\/');\n    if ($domain_start === false) {\n        $domain_start = 0;\n    } else {\n        $domain_start += 3; \/\/ ':\/\/' \u306e\u9577\u3055\n    }\n    \n    \/\/ \u30d1\u30b9\u90e8\u5206\u3092\u30b9\u30ad\u30c3\u30d7\n    $domain_end = strpos($url, '\/', $domain_start);\n    if ($domain_end === false) {\n        $domain = substr($url, $domain_start);\n    } else {\n        $domain = substr($url, $domain_start, $domain_end - $domain_start);\n    }\n    \n    return $domain;\n}\n\n$url = \"https:\/\/www.example.com\/path\/to\/page.php?id=123\";\necho \"\u30c9\u30e1\u30a4\u30f3: \" . extractDomain($url); \/\/ \u51fa\u529b: www.example.com\n\n\/\/ \u30af\u30a8\u30ea\u6587\u5b57\u5217\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u89e3\u6790\nfunction getQueryParam($url, $param) {\n    $query_start = strpos($url, '?');\n    if ($query_start === false) {\n        return null; \/\/ \u30af\u30a8\u30ea\u6587\u5b57\u5217\u304c\u306a\u3044\n    }\n    \n    $query_string = substr($url, $query_start + 1);\n    $param_marker = $param . '=';\n    $param_pos = strpos($query_string, $param_marker);\n    \n    if ($param_pos === false) {\n        return null; \/\/ \u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u898b\u3064\u304b\u3089\u306a\u3044\n    }\n    \n    $value_start = $param_pos + strlen($param_marker);\n    $value_end = strpos($query_string, '&amp;', $value_start);\n    \n    if ($value_end === false) {\n        return substr($query_string, $value_start);\n    } else {\n        return substr($query_string, $value_start, $value_end - $value_start);\n    }\n}\n\n$url = \"https:\/\/example.com\/search.php?q=php+tutorial&amp;page=2&amp;sort=date\";\necho \"\u691c\u7d22\u30af\u30a8\u30ea: \" . getQueryParam($url, 'q'); \/\/ \u51fa\u529b: php+tutorial\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-22\">CSV\/JSON\u30c7\u30fc\u30bf\u5185\u306e\u7279\u5b9a\u6587\u5b57\u5217\u691c\u7d22\u5b9f\u88c5\u6cd5<\/h3>\n\n\n\n<p>\u30c7\u30fc\u30bf\u30d5\u30a1\u30a4\u30eb\u306e\u51e6\u7406\u306f\u591a\u304f\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u5fc5\u8981\u3068\u3055\u308c\u308b\u6a5f\u80fd\u3067\u3059\u3002<code>strpos()<\/code>\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u8907\u96d1\u306a\u30d1\u30fc\u30b9\u51e6\u7406\u3092\u305b\u305a\u306b\u7279\u5b9a\u306e\u60c5\u5831\u3092\u52b9\u7387\u7684\u306b\u691c\u7d22\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=\"\">\/\/ CSV\u30d5\u30a1\u30a4\u30eb\u306e\u30d8\u30c3\u30c0\u30fc\u691c\u8a3c\nfunction validateCsvHeaders($file_path, $required_headers) {\n    $handle = fopen($file_path, 'r');\n    if (!$handle) {\n        return false;\n    }\n    \n    \/\/ \u30d8\u30c3\u30c0\u30fc\u884c\u3092\u8aad\u307f\u8fbc\u3080\n    $headers = fgetcsv($handle);\n    fclose($handle);\n    \n    \/\/ \u5fc5\u9808\u30d8\u30c3\u30c0\u30fc\u306e\u78ba\u8a8d\n    foreach ($required_headers as $header) {\n        if (!in_array($header, $headers)) {\n            return false; \/\/ \u5fc5\u9808\u30d8\u30c3\u30c0\u30fc\u304c\u898b\u3064\u304b\u3089\u306a\u3044\n        }\n    }\n    \n    return true;\n}\n\n\/\/ CSV\u30d5\u30a1\u30a4\u30eb\u5185\u306e\u7279\u5b9a\u306e\u5024\u3092\u691c\u7d22\nfunction searchInCsv($file_path, $search_term) {\n    $handle = fopen($file_path, 'r');\n    if (!$handle) {\n        return [];\n    }\n    \n    $results = [];\n    $row_number = 0;\n    \n    \/\/ \u30d5\u30a1\u30a4\u30eb\u30921\u884c\u305a\u3064\u8aad\u307f\u8fbc\u3080\n    while (($row = fgetcsv($handle)) !== false) {\n        $row_number++;\n        \n        \/\/ \u884c\u5185\u306e\u5404\u30bb\u30eb\u3092\u691c\u7d22\n        foreach ($row as $cell) {\n            if (strpos($cell, $search_term) !== false) {\n                $results[] = \"\u884c {$row_number}: {$cell}\";\n            }\n        }\n    }\n    \n    fclose($handle);\n    return $results;\n}\n\n\/\/ JSON\u30c7\u30fc\u30bf\u5185\u306e\u7279\u5b9a\u30ad\u30fc\u30ef\u30fc\u30c9\u691c\u7d22\nfunction searchInJson($json_data, $keyword) {\n    \/\/ \u9ad8\u901f\u30c1\u30a7\u30c3\u30af: \u30ad\u30fc\u30ef\u30fc\u30c9\u304cJSON\u30c6\u30ad\u30b9\u30c8\u306b\u542b\u307e\u308c\u3066\u3044\u308b\u304b\n    if (strpos($json_data, $keyword) === false) {\n        return false; \/\/ \u30ad\u30fc\u30ef\u30fc\u30c9\u304c\u306a\u3044\u306e\u3067\u30c7\u30b3\u30fc\u30c9\u3059\u308b\u5fc5\u8981\u306a\u3057\n    }\n    \n    \/\/ \u30ad\u30fc\u30ef\u30fc\u30c9\u304c\u898b\u3064\u304b\u3063\u305f\u306e\u3067\u8a73\u7d30\u306b\u89e3\u6790\n    $data = json_decode($json_data, true);\n    return searchArrayRecursive($data, $keyword);\n}\n\nfunction searchArrayRecursive($array, $keyword) {\n    $results = [];\n    \n    foreach ($array as $key =&gt; $value) {\n        \/\/ \u30ad\u30fc\u306b\u691c\u7d22\u8a9e\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\n        if (strpos($key, $keyword) !== false) {\n            $results[$key] = $value;\n        }\n        \n        \/\/ \u5024\u304c\u6587\u5b57\u5217\u3067\u691c\u7d22\u8a9e\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\n        if (is_string($value) &amp;&amp; strpos($value, $keyword) !== false) {\n            $results[$key] = $value;\n        }\n        \n        \/\/ \u5024\u304c\u914d\u5217\u306a\u3089\u518d\u5e30\u7684\u306b\u691c\u7d22\n        if (is_array($value)) {\n            $sub_results = searchArrayRecursive($value, $keyword);\n            if (!empty($sub_results)) {\n                $results[$key] = $sub_results;\n            }\n        }\n    }\n    \n    return $results;\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-23\">\u7279\u5b9a\u306e\u5358\u8a9e\u3084\u30d5\u30ec\u30fc\u30ba\u306e\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u6a5f\u80fd\u5b9f\u88c5<\/h3>\n\n\n\n<p>\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u751f\u6210\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u6271\u3046\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u3068\u3063\u3066\u91cd\u8981\u306a\u6a5f\u80fd\u3067\u3059\u3002<code>strpos()<\/code>\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u52b9\u7387\u7684\u306a\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u30b7\u30b9\u30c6\u30e0\u3092\u69cb\u7bc9\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=\"\">\/\/ \u4e0d\u9069\u5207\u306a\u5358\u8a9e\u3092\u30de\u30b9\u30af\u51e6\u7406\u3059\u308b\u95a2\u6570\nfunction censorText($text, $bad_words) {\n    foreach ($bad_words as $word) {\n        \/\/ \u5358\u8a9e\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\n        if (strpos(strtolower($text), strtolower($word)) !== false) {\n            \/\/ \u5358\u8a9e\u3092\u30a2\u30b9\u30bf\u30ea\u30b9\u30af\u3067\u7f6e\u63db\n            $replacement = str_repeat('*', strlen($word));\n            $text = str_ireplace($word, $replacement, $text);\n        }\n    }\n    return $text;\n}\n\n$comment = \"This is a bad comment with inappropriate language.\";\n$bad_words = ['bad', 'inappropriate'];\necho censorText($comment, $bad_words);\n\/\/ \u51fa\u529b: This is a *** comment with ************* language.\n\n\/\/ \u30ad\u30fc\u30ef\u30fc\u30c9\u30d9\u30fc\u30b9\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u30ab\u30c6\u30b4\u30ea\u5206\u985e\nfunction categorizeContent($text, $categories) {\n    $result = [];\n    $text_lower = strtolower($text);\n    \n    foreach ($categories as $category =&gt; $keywords) {\n        foreach ($keywords as $keyword) {\n            if (strpos($text_lower, strtolower($keyword)) !== false) {\n                $result[] = $category;\n                break; \/\/ \u3053\u306e\u5206\u985e\u306b\u4e00\u81f4\u3059\u308b\u3082\u306e\u304c\u898b\u3064\u304b\u3063\u305f\u3089\u6b21\u306e\u5206\u985e\u3078\n            }\n        }\n    }\n    \n    return $result;\n}\n\n$article = \"PHP\u306b\u3088\u308bWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306f\u52b9\u7387\u7684\u3067\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u9023\u643a\u3082\u5bb9\u6613\u3067\u3059\u3002\";\n$categories = [\n    '\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0' =&gt; ['php', 'java', 'python', 'javascript'],\n    'Web\u958b\u767a' =&gt; ['\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3', '\u30b5\u30a4\u30c8', 'html', 'css'],\n    '\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9' =&gt; ['mysql', '\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9', 'sql', 'nosql']\n];\n\n$article_categories = categorizeContent($article, $categories);\necho \"\u8a18\u4e8b\u306e\u30ab\u30c6\u30b4\u30ea: \" . implode(', ', $article_categories);\n\/\/ \u51fa\u529b: \u8a18\u4e8b\u306e\u30ab\u30c6\u30b4\u30ea: \u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0, Web\u958b\u767a, \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-24\">HTML\u30bf\u30b0\u306e\u691c\u51fa\u3068\u51e6\u7406\u306e\u5b9f\u88c5\u4f8b<\/h3>\n\n\n\n<p>HTML\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u51e6\u7406\u306f\u3001Web\u30b9\u30af\u30ec\u30a4\u30d4\u30f3\u30b0\u3001CMS\u30b7\u30b9\u30c6\u30e0\u3001\u30ea\u30c3\u30c1\u30c6\u30ad\u30b9\u30c8\u30a8\u30c7\u30a3\u30bf\u306a\u3069\u3067\u983b\u7e41\u306b\u884c\u308f\u308c\u307e\u3059\u3002<code>strpos()<\/code>\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u7c21\u5358\u306aHTML\u30d1\u30fc\u30b5\u30fc\u3092\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u57fa\u672c\u7684\u306aHTML\u30bf\u30b0\u306e\u691c\u51fa\nfunction hasHtmlTags($text) {\n    return strpos($text, '&lt;') !== false &amp;&amp; strpos($text, '&gt;') !== false;\n}\n\n\/\/ \u7279\u5b9a\u306eHTML\u30bf\u30b0\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\nfunction containsTag($html, $tag) {\n    $open_tag = '&lt;' . $tag;\n    $close_tag = '&lt;\/' . $tag . '&gt;';\n    \n    return strpos($html, $open_tag) !== false || strpos($html, $close_tag) !== false;\n}\n\n\/\/ HTML\u304b\u3089\u30e1\u30bf\u30bf\u30b0\u306e\u5185\u5bb9\u3092\u62bd\u51fa\nfunction extractMetaTags($html) {\n    $meta_tags = [];\n    $offset = 0;\n    \n    while (($start = strpos($html, '&lt;meta', $offset)) !== false) {\n        $end = strpos($html, '&gt;', $start);\n        if ($end === false) break;\n        \n        $meta_html = substr($html, $start, $end - $start + 1);\n        \n        \/\/ name\u5c5e\u6027\u3092\u62bd\u51fa\n        $name_pos = strpos($meta_html, 'name=\"');\n        if ($name_pos !== false) {\n            $name_start = $name_pos + 6; \/\/ 'name=\"' \u306e\u9577\u3055\n            $name_end = strpos($meta_html, '\"', $name_start);\n            $name = substr($meta_html, $name_start, $name_end - $name_start);\n            \n            \/\/ content\u5c5e\u6027\u3092\u62bd\u51fa\n            $content_pos = strpos($meta_html, 'content=\"');\n            if ($content_pos !== false) {\n                $content_start = $content_pos + 9; \/\/ 'content=\"' \u306e\u9577\u3055\n                $content_end = strpos($meta_html, '\"', $content_start);\n                $content = substr($meta_html, $content_start, $content_end - $content_start);\n                \n                $meta_tags[$name] = $content;\n            }\n        }\n        \n        $offset = $end + 1;\n    }\n    \n    return $meta_tags;\n}\n\n$html = '&lt;html&gt;&lt;head&gt;&lt;meta name=\"description\" content=\"PHP tutorial\"&gt;&lt;meta name=\"keywords\" content=\"php, programming\"&gt;&lt;\/head&gt;&lt;body&gt;...&lt;\/body&gt;&lt;\/html&gt;';\n$meta_info = extractMetaTags($html);\nprint_r($meta_info);\n\/\/ \u51fa\u529b: Array ( [description] =&gt; PHP tutorial [keywords] =&gt; php, programming )\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-25\">\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u89e3\u6790\u3067\u306e\u6d3b\u7528\u65b9\u6cd5<\/h3>\n\n\n\n<p>\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u306e\u89e3\u6790\u306f\u3001\u30b7\u30b9\u30c6\u30e0\u7ba1\u7406\u3084\u30c7\u30d0\u30c3\u30b0\u306b\u304a\u3044\u3066\u91cd\u8981\u306a\u4f5c\u696d\u3067\u3059\u3002<code>strpos()<\/code>\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u5927\u91cf\u306e\u30ed\u30b0\u30c7\u30fc\u30bf\u304b\u3089\u7279\u5b9a\u306e\u30d1\u30bf\u30fc\u30f3\u3084\u60c5\u5831\u3092\u7d20\u65e9\u304f\u62bd\u51fa\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=\"\">\/\/ \u30a8\u30e9\u30fc\u30ed\u30b0\u304b\u3089PHP\u30a8\u30e9\u30fc\u3092\u62bd\u51fa\nfunction extractPhpErrors($log_file) {\n    $errors = [];\n    $handle = fopen($log_file, 'r');\n    \n    if (!$handle) {\n        return $errors;\n    }\n    \n    $error_types = ['Fatal error', 'Parse error', 'Warning', 'Notice', 'Deprecated'];\n    \n    while (($line = fgets($handle)) !== false) {\n        foreach ($error_types as $error_type) {\n            if (strpos($line, \"PHP $error_type\") !== false) {\n                $errors[] = trim($line);\n                break;\n            }\n        }\n    }\n    \n    fclose($handle);\n    return $errors;\n}\n\n\/\/ \u30a2\u30af\u30bb\u30b9\u30ed\u30b0\u304b\u3089\u7279\u5b9a\u306eIP\u30a2\u30c9\u30ec\u30b9\u306e\u30a2\u30af\u30bb\u30b9\u3092\u62bd\u51fa\nfunction findAccessByIp($access_log, $ip_address) {\n    $matches = [];\n    $handle = fopen($access_log, 'r');\n    \n    if (!$handle) {\n        return $matches;\n    }\n    \n    while (($line = fgets($handle)) !== false) {\n        if (strpos($line, $ip_address) === 0) { \/\/ IP\u304c\u884c\u306e\u5148\u982d\u306b\u3042\u308b\u5834\u5408\n            $matches[] = trim($line);\n        }\n    }\n    \n    fclose($handle);\n    return $matches;\n}\n\n\/\/ \u30ed\u30b0\u304b\u3089HTTP\u30b9\u30c6\u30fc\u30bf\u30b9\u30b3\u30fc\u30c9404\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u62bd\u51fa\nfunction find404Requests($access_log) {\n    $not_found = [];\n    $handle = fopen($access_log, 'r');\n    \n    if (!$handle) {\n        return $not_found;\n    }\n    \n    while (($line = fgets($handle)) !== false) {\n        if (strpos($line, '\" 404 ') !== false) {\n            \/\/ URL\u3092\u62bd\u51fa\n            preg_match('\/GET (.*?) HTTP\/', $line, $matches);\n            if (!empty($matches[1])) {\n                $not_found[] = $matches[1];\n            }\n        }\n    }\n    \n    fclose($handle);\n    return $not_found;\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-26\">\u6587\u5b57\u5217\u306e\u7f6e\u63db\u524d\u306e\u6761\u4ef6\u30c1\u30a7\u30c3\u30af\u3067\u306e\u4f7f\u7528\u6cd5<\/h3>\n\n\n\n<p>\u5927\u898f\u6a21\u306a\u6587\u5b57\u5217\u51e6\u7406\u3084\u7f6e\u63db\u64cd\u4f5c\u3092\u884c\u3046\u524d\u306b\u3001\u5bfe\u8c61\u306e\u6587\u5b57\u5217\u304c\u5b9f\u969b\u306b\u5b58\u5728\u3059\u308b\u304b\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u3067\u3001\u4e0d\u8981\u306a\u51e6\u7406\u3092\u56de\u907f\u3057\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u5411\u4e0a\u3055\u305b\u308b\u3053\u3068\u304c\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=\"\">\/\/ \u52b9\u7387\u7684\u306a\u7f6e\u63db\u51e6\u7406\nfunction efficientReplace($text, $search, $replace) {\n    \/\/ \u691c\u7d22\u6587\u5b57\u5217\u304c\u5b58\u5728\u3059\u308b\u304b\u4e8b\u524d\u30c1\u30a7\u30c3\u30af\n    if (strpos($text, $search) === false) {\n        return $text; \/\/ \u691c\u7d22\u6587\u5b57\u5217\u304c\u306a\u3044\u306e\u3067\u5909\u66f4\u4e0d\u8981\n    }\n    \n    \/\/ \u691c\u7d22\u6587\u5b57\u5217\u304c\u898b\u3064\u304b\u3063\u305f\u306e\u3067\u7f6e\u63db\u3092\u5b9f\u884c\n    return str_replace($search, $replace, $text);\n}\n\n\/\/ \u5927\u91cf\u306e\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u306b\u304a\u3051\u308b\u52b9\u7387\u7684\u306a\u4e00\u62ec\u7f6e\u63db\nfunction batchReplaceInFiles($directory, $search, $replace) {\n    $files = glob($directory . '\/*.txt');\n    $changed_files = 0;\n    \n    foreach ($files as $file) {\n        $content = file_get_contents($file);\n        \n        \/\/ \u691c\u7d22\u6587\u5b57\u5217\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u307f\u51e6\u7406\n        if (strpos($content, $search) !== false) {\n            $new_content = str_replace($search, $replace, $content);\n            file_put_contents($file, $new_content);\n            $changed_files++;\n        }\n    }\n    \n    return $changed_files;\n}\n\n\/\/ \u6761\u4ef6\u4ed8\u304d\u7f6e\u63db\u306e\u3055\u3089\u306a\u308b\u6700\u9069\u5316\u4f8b\nfunction smartReplace($text, $patterns) {\n    \/\/ \u5168\u30d1\u30bf\u30fc\u30f3\u304c\u4e00\u5ea6\u3082\u51fa\u73fe\u3057\u306a\u3044\u304b\u3092\u9ad8\u901f\u30c1\u30a7\u30c3\u30af\n    $needs_processing = false;\n    foreach ($patterns as $search =&gt; $replace) {\n        if (strpos($text, $search) !== false) {\n            $needs_processing = true;\n            break;\n        }\n    }\n    \n    \/\/ \u4e00\u81f4\u3059\u308b\u3082\u306e\u304c\u306a\u3051\u308c\u3070\u305d\u306e\u307e\u307e\u8fd4\u3059\n    if (!$needs_processing) {\n        return $text;\n    }\n    \n    \/\/ \u5fc5\u8981\u306a\u7f6e\u63db\u306e\u307f\u3092\u5b9f\u884c\n    foreach ($patterns as $search =&gt; $replace) {\n        if (strpos($text, $search) !== false) {\n            $text = str_replace($search, $replace, $text);\n        }\n    }\n    \n    return $text;\n}\n\n\/\/ \u5b9f\u969b\u306e\u4f7f\u7528\u4f8b\n$text = \"\u3053\u308c\u306fPHP\u306e\u6587\u5b57\u5217\u64cd\u4f5c\u306b\u3064\u3044\u3066\u306e\u8a18\u4e8b\u3067\u3059\u3002PHP\u306fWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306b\u3088\u304f\u4f7f\u308f\u308c\u307e\u3059\u3002\";\n$patterns = [\n    'PHP' =&gt; '&lt;strong&gt;PHP&lt;\/strong&gt;',\n    'Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3' =&gt; '&lt;em&gt;Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3&lt;\/em&gt;',\n    'Java' =&gt; '&lt;strong&gt;Java&lt;\/strong&gt;' \/\/ \u30c6\u30ad\u30b9\u30c8\u5185\u306b\u5b58\u5728\u3057\u306a\u3044\u30d1\u30bf\u30fc\u30f3\n];\n\n$formatted_text = smartReplace($text, $patterns);\necho $formatted_text;\n\/\/ \u51fa\u529b: \u3053\u308c\u306f&lt;strong&gt;PHP&lt;\/strong&gt;\u306e\u6587\u5b57\u5217\u64cd\u4f5c\u306b\u3064\u3044\u3066\u306e\u8a18\u4e8b\u3067\u3059\u3002&lt;strong&gt;PHP&lt;\/strong&gt;\u306f&lt;em&gt;Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3&lt;\/em&gt;\u958b\u767a\u306b\u3088\u304f\u4f7f\u308f\u308c\u307e\u3059\u3002\n\n### \u8907\u6570\u6761\u4ef6\u3092\u7d44\u307f\u5408\u308f\u305b\u305f\u9ad8\u5ea6\u306a\u6587\u5b57\u5217\u64cd\u4f5c\u30c6\u30af\u30cb\u30c3\u30af\n\n\u8907\u6570\u306e\u6761\u4ef6\u3084\u691c\u7d22\u30d1\u30bf\u30fc\u30f3\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u7cbe\u7dfb\u306a\u6587\u5b57\u5217\u51e6\u7406\u3092\u5b9f\u73fe\u3067\u304d\u307e\u3059\u3002\n\n```php\n\/\/ \u8907\u6570\u306e\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u542b\u3080\u884c\u3092\u62bd\u51fa\u3059\u308b\u95a2\u6570\nfunction extractLinesWithAllKeywords($text, $keywords) {\n    $lines = explode(\"\\n\", $text);\n    $result = [];\n    \n    foreach ($lines as $line) {\n        $contains_all = true;\n        \n        foreach ($keywords as $keyword) {\n            if (strpos($line, $keyword) === false) {\n                $contains_all = false;\n                break;\n            }\n        }\n        \n        if ($contains_all) {\n            $result[] = $line;\n        }\n    }\n    \n    return $result;\n}\n\n\/\/ \u7279\u5b9a\u306e\u69cb\u9020\u3092\u6301\u3064\u30ed\u30b0\u30a8\u30f3\u30c8\u30ea\u3092\u89e3\u6790\nfunction parseStructuredLogs($log_content, $pattern_start, $pattern_end) {\n    $entries = [];\n    $offset = 0;\n    \n    while (true) {\n        \/\/ \u30a8\u30f3\u30c8\u30ea\u958b\u59cb\u30d1\u30bf\u30fc\u30f3\u3092\u691c\u7d22\n        $start_pos = strpos($log_content, $pattern_start, $offset);\n        if ($start_pos === false) {\n            break; \/\/ \u958b\u59cb\u30d1\u30bf\u30fc\u30f3\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u7d42\u4e86\n        }\n        \n        \/\/ \u30a8\u30f3\u30c8\u30ea\u7d42\u4e86\u30d1\u30bf\u30fc\u30f3\u3092\u691c\u7d22\n        $content_start = $start_pos + strlen($pattern_start);\n        $end_pos = strpos($log_content, $pattern_end, $content_start);\n        if ($end_pos === false) {\n            break; \/\/ \u7d42\u4e86\u30d1\u30bf\u30fc\u30f3\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u7d42\u4e86\n        }\n        \n        \/\/ \u30a8\u30f3\u30c8\u30ea\u5185\u5bb9\u3092\u62bd\u51fa\n        $entry_content = substr($log_content, $content_start, $end_pos - $content_start);\n        $entries[] = $entry_content;\n        \n        \/\/ \u6b21\u306e\u691c\u7d22\u4f4d\u7f6e\u3092\u66f4\u65b0\n        $offset = $end_pos + strlen($pattern_end);\n    }\n    \n    return $entries;\n}\n\n\/\/ \u968e\u5c64\u69cb\u9020\u3092\u6301\u3064\u30c7\u30fc\u30bf\u306e\u89e3\u6790\u4f8b\nfunction extractNestedData($text, $outer_start, $outer_end, $inner_start, $inner_end) {\n    $result = [];\n    $outer_offset = 0;\n    \n    while (($outer_start_pos = strpos($text, $outer_start, $outer_offset)) !== false) {\n        $content_start = $outer_start_pos + strlen($outer_start);\n        $outer_end_pos = strpos($text, $outer_end, $content_start);\n        \n        if ($outer_end_pos === false) break;\n        \n        \/\/ \u5916\u5074\u306e\u533a\u5207\u308a\u5185\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u53d6\u5f97\n        $outer_content = substr($text, $content_start, $outer_end_pos - $content_start);\n        \n        \/\/ \u5185\u5074\u306e\u533a\u5207\u308a\u3067\u30c7\u30fc\u30bf\u3092\u62bd\u51fa\n        $inner_data = [];\n        $inner_offset = 0;\n        \n        while (($inner_start_pos = strpos($outer_content, $inner_start, $inner_offset)) !== false) {\n            $inner_content_start = $inner_start_pos + strlen($inner_start);\n            $inner_end_pos = strpos($outer_content, $inner_end, $inner_content_start);\n            \n            if ($inner_end_pos === false) break;\n            \n            $inner_content = substr($outer_content, $inner_content_start, $inner_end_pos - $inner_content_start);\n            $inner_data[] = $inner_content;\n            \n            $inner_offset = $inner_end_pos + strlen($inner_end);\n        }\n        \n        $result[] = $inner_data;\n        $outer_offset = $outer_end_pos + strlen($outer_end);\n    }\n    \n    return $result;\n}\n\n\/\/ \u7c21\u6613\u7684\u306aMarkdown\u89e3\u6790\u306e\u4f8b\nfunction extractMarkdownHeadings($markdown) {\n    $lines = explode(\"\\n\", $markdown);\n    $headings = [];\n    \n    foreach ($lines as $line) {\n        \/\/ \u898b\u51fa\u3057\u3092\u691c\u51fa\uff08# \u3067\u59cb\u307e\u308b\u884c\uff09\n        if (strpos($line, '# ') === 0) {\n            \/\/ \u898b\u51fa\u3057\u30ec\u30d9\u30eb\u3092\u5224\u5b9a\n            $level = 1;\n            while (strpos($line, '# ', $level) === $level) {\n                $level++;\n            }\n            \n            \/\/ \u898b\u51fa\u3057\u30c6\u30ad\u30b9\u30c8\u3092\u62bd\u51fa\n            $heading_text = trim(substr($line, $level + 1));\n            $headings[] = [\n                'level' =&gt; $level,\n                'text' =&gt; $heading_text\n            ];\n        }\n    }\n    \n    return $headings;\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-27\">API\u30ec\u30b9\u30dd\u30f3\u30b9\u30c7\u30fc\u30bf\u306e\u30d1\u30fc\u30b9\u51e6\u7406\u3067\u306e\u6d3b\u7528\u4f8b<\/h3>\n\n\n\n<p>API\u3068\u306e\u9023\u643a\u306f\u73fe\u4ee3\u306eWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306b\u304a\u3044\u3066\u4e0d\u53ef\u6b20\u306a\u8981\u7d20\u3067\u3059\u3002<code>strpos()<\/code>\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001API\u30ec\u30b9\u30dd\u30f3\u30b9\u306e\u9ad8\u901f\u306a\u4e8b\u524d\u8a55\u4fa1\u3084\u52b9\u7387\u7684\u306a\u51e6\u7406\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ JSON\u30ec\u30b9\u30dd\u30f3\u30b9\u306e\u4e8b\u524d\u8a55\u4fa1\nfunction preCheckApiResponse($response) {\n    \/\/ \u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u4e8b\u524d\u30c1\u30a7\u30c3\u30af\n    if (strpos($response, '\"error\"') !== false) {\n        \/\/ \u30a8\u30e9\u30fc\u306e\u8a73\u7d30\u3092\u89e3\u6790\n        $data = json_decode($response, true);\n        return [\n            'status' =&gt; 'error',\n            'message' =&gt; $data['error'] ?? 'Unknown error'\n        ];\n    }\n    \n    \/\/ \u6210\u529f\u30b9\u30c6\u30fc\u30bf\u30b9\u306e\u78ba\u8a8d\n    if (strpos($response, '\"success\":true') !== false) {\n        return [\n            'status' =&gt; 'success',\n            'needsParsing' =&gt; true\n        ];\n    }\n    \n    \/\/ \u305d\u306e\u4ed6\u306e\u72b6\u614b\n    return [\n        'status' =&gt; 'unknown',\n        'needsParsing' =&gt; true\n    ];\n}\n\n\/\/ API\u30ec\u30b9\u30dd\u30f3\u30b9\u304b\u3089\u7279\u5b9a\u306e\u30c7\u30fc\u30bf\u69cb\u9020\u3060\u3051\u3092\u62bd\u51fa\nfunction extractApiData($api_response, $data_marker) {\n    \/\/ \u30c7\u30fc\u30bf\u30de\u30fc\u30ab\u30fc\u306e\u4f4d\u7f6e\u3092\u7279\u5b9a\n    $marker_pos = strpos($api_response, $data_marker);\n    if ($marker_pos === false) {\n        return null; \/\/ \u76ee\u7684\u306e\u30c7\u30fc\u30bf\u304c\u898b\u3064\u304b\u3089\u306a\u3044\n    }\n    \n    \/\/ JSON\u69cb\u9020\u306e\u958b\u59cb\u4f4d\u7f6e\u3092\u7279\u5b9a\n    $json_start = strpos($api_response, '{', $marker_pos);\n    if ($json_start === false) {\n        $json_start = strpos($api_response, '[', $marker_pos);\n        if ($json_start === false) {\n            return null; \/\/ JSON\u69cb\u9020\u304c\u898b\u3064\u304b\u3089\u306a\u3044\n        }\n    }\n    \n    \/\/ JSON\u306e\u7d42\u4e86\u4f4d\u7f6e\u3092\u7279\u5b9a\uff08\u5165\u308c\u5b50\u69cb\u9020\u3092\u8003\u616e\u3059\u308b\u7c21\u6613\u5b9f\u88c5\uff09\n    $open_braces = 1;\n    $is_array = $api_response[$json_start] === '[';\n    $search_char = $is_array ? ']' : '}';\n    $open_char = $is_array ? '[' : '{';\n    \n    $pos = $json_start + 1;\n    $length = strlen($api_response);\n    \n    while ($open_braces &gt; 0 &amp;&amp; $pos &lt; $length) {\n        if ($api_response[$pos] === $search_char) {\n            $open_braces--;\n        } elseif ($api_response[$pos] === $open_char) {\n            $open_braces++;\n        }\n        $pos++;\n    }\n    \n    if ($open_braces &gt; 0) {\n        return null; \/\/ JSON\u304c\u6b63\u3057\u304f\u9589\u3058\u3089\u308c\u3066\u3044\u306a\u3044\n    }\n    \n    \/\/ \u7279\u5b9a\u3055\u308c\u305fJSON\u90e8\u5206\u3092\u62bd\u51fa\u3057\u3066\u89e3\u6790\n    $json_part = substr($api_response, $json_start, $pos - $json_start);\n    return json_decode($json_part, true);\n}\n\n\/\/ WebAPI\u306e\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u691c\u51fa\u3068\u52d5\u7684\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u8a2d\u5b9a\nfunction buildApiUrl($base_url, $endpoint, $params = []) {\n    \/\/ \u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u304cURL\u306b\u542b\u307e\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\n    if (strpos($base_url, $endpoint) !== false) {\n        $url = $base_url;\n    } else {\n        \/\/ \u30d9\u30fc\u30b9URL\u304c\/\u3067\u7d42\u308f\u308b\u304b\u3069\u3046\u304b\u3092\u78ba\u8a8d\n        if (substr($base_url, -1) !== '\/') {\n            $base_url .= '\/';\n        }\n        \n        \/\/ \u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u304c\/\u3067\u59cb\u307e\u308b\u5834\u5408\u306f\u524a\u9664\n        if (strpos($endpoint, '\/') === 0) {\n            $endpoint = substr($endpoint, 1);\n        }\n        \n        $url = $base_url . $endpoint;\n    }\n    \n    \/\/ \u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u3042\u308b\u5834\u5408\u306f\u30af\u30a8\u30ea\u6587\u5b57\u5217\u3092\u69cb\u7bc9\n    if (!empty($params)) {\n        $query = http_build_query($params);\n        $url .= (strpos($url, '?') !== false) ? '&amp;' : '?';\n        $url .= $query;\n    }\n    \n    return $url;\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$api_url = \"https:\/\/api.example.com\/v1\/\";\n$endpoint = \"users\";\n$params = ['status' =&gt; 'active', 'limit' =&gt; 10];\n\n$full_url = buildApiUrl($api_url, $endpoint, $params);\necho $full_url; \/\/ https:\/\/api.example.com\/v1\/users?status=active&amp;limit=10\n<\/pre>\n\n\n\n<p>\u3053\u308c\u3089\u306e9\u3064\u306e\u5b9f\u7528\u4f8b\u306f\u3001PHP\u958b\u767a\u306b\u304a\u3051\u308b<code>strpos()<\/code>\u95a2\u6570\u306e\u6c4e\u7528\u6027\u3068\u5b9f\u7528\u6027\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002\u5358\u7d14\u306a\u6587\u5b57\u5217\u691c\u7d22\u304b\u3089\u8907\u96d1\u306a\u30c7\u30fc\u30bf\u89e3\u6790\u307e\u3067\u3001\u9069\u5207\u306b\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u52b9\u7387\u7684\u3067\u5805\u7262\u306a\u30b3\u30fc\u30c9\u3092\u5b9f\u73fe\u3067\u304d\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-28\">PHP strpos()\u3068\u95a2\u9023\u95a2\u6570\u306e\u6bd4\u8f03\u3068\u4f7f\u3044\u5206\u3051<\/h2>\n\n\n\n<p>PHP\u306b\u304a\u3051\u308b\u6587\u5b57\u5217\u64cd\u4f5c\u306b\u306f\u591a\u304f\u306e\u95a2\u6570\u304c\u7528\u610f\u3055\u308c\u3066\u304a\u308a\u3001\u72b6\u6cc1\u306b\u5fdc\u3058\u3066\u9069\u5207\u306a\u95a2\u6570\u3092\u9078\u629e\u3059\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002\u3053\u306e\u7ae0\u3067\u306f\u3001<code>strpos()<\/code>\u3068\u95a2\u9023\u3059\u308b\u6587\u5b57\u5217\u691c\u7d22\u30fb\u64cd\u4f5c\u95a2\u6570\u3092\u6bd4\u8f03\u3057\u3001\u305d\u308c\u305e\u308c\u306e\u9069\u5207\u306a\u4f7f\u7528\u30b7\u30fc\u30f3\u3092\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-29\">stripos()\u3068\u306e\u9055\u3044\u3068\u6700\u9069\u306a\u9078\u629e\u57fa\u6e96<\/h3>\n\n\n\n<p><code>strpos()<\/code>\u3068<code>stripos()<\/code>\u306f\u975e\u5e38\u306b\u4f3c\u305f\u6a5f\u80fd\u3092\u6301\u3061\u307e\u3059\u304c\u3001\u91cd\u8981\u306a\u9055\u3044\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-30\">\u57fa\u672c\u7684\u306a\u9055\u3044<\/h4>\n\n\n<div id=\"id-8cb49cda-7714-4aca-a13b-ae47d51a7524\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u6a5f\u80fd<\/th><th>strpos()<\/th><th>stripos()<\/th><\/tr><\/thead><tbody><tr><td>\u57fa\u672c\u6a5f\u80fd<\/td><td>\u6587\u5b57\u5217\u5185\u306e\u90e8\u5206\u6587\u5b57\u5217\u306e\u4f4d\u7f6e\u3092\u691c\u7d22<\/td><td>\u6587\u5b57\u5217\u5185\u306e\u90e8\u5206\u6587\u5b57\u5217\u306e\u4f4d\u7f6e\u3092\u691c\u7d22<\/td><\/tr><tr><td>\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u306e\u533a\u5225<\/td><td><strong>\u533a\u5225\u3059\u308b<\/strong><\/td><td><strong>\u533a\u5225\u3057\u306a\u3044<\/strong><\/td><\/tr><tr><td>\u30b7\u30f3\u30bf\u30c3\u30af\u30b9<\/td><td>strpos($haystack, $needle, $offset = 0)<\/td><td>stripos($haystack, $needle, $offset = 0)<\/td><\/tr><tr><td>\u623b\u308a\u5024<\/td><td>\u6574\u6570\uff08\u4f4d\u7f6e\uff09\u307e\u305f\u306ffalse<\/td><td>\u6574\u6570\uff08\u4f4d\u7f6e\uff09\u307e\u305f\u306ffalse<\/td><\/tr><tr><td>PHP\u30d0\u30fc\u30b8\u30e7\u30f3<\/td><td>\u5168\u3066\u306e\u30d0\u30fc\u30b8\u30e7\u30f3<\/td><td>PHP 5.0.0\u4ee5\u964d<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<h4 class=\"wp-block-heading\" id=\"i-31\">\u4f7f\u7528\u4f8b\u3068\u9055\u3044<\/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 is a powerful language for web development\";\n\n\/\/ \u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3059\u308b\u691c\u7d22\n$pos1 = strpos($text, \"PHP\");  \/\/ 0\u3092\u8fd4\u3059\n$pos2 = strpos($text, \"php\");  \/\/ false\u3092\u8fd4\u3059\uff08\u898b\u3064\u304b\u3089\u306a\u3044\uff09\n\n\/\/ \u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22\n$pos3 = stripos($text, \"PHP\"); \/\/ 0\u3092\u8fd4\u3059\n$pos4 = stripos($text, \"php\"); \/\/ 0\u3092\u8fd4\u3059\uff08\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u306e\u3067\u898b\u3064\u304b\u308b\uff09\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-32\">\u6700\u9069\u306a\u9078\u629e\u57fa\u6e96<\/h4>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u5834\u5408\u306f<code>strpos()<\/code>\u3092\u4f7f\u7528\u3057\u307e\u3057\u3087\u3046\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u5834\u5408\uff08\u4f8b\uff1a\u30d1\u30b9\u30ef\u30fc\u30c9\u691c\u8a3c\u3001\u6b63\u78ba\u306a\u30ad\u30fc\u30ef\u30fc\u30c9\u30de\u30c3\u30c1\u30f3\u30b0\uff09<\/li>\n\n\n\n<li>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u7279\u306b\u91cd\u8981\u306a\u5834\u5408\uff08<code>strpos()<\/code>\u306f<code>stripos()<\/code>\u3088\u308a\u308f\u305a\u304b\u306b\u9ad8\u901f\uff09<\/li>\n\n\n\n<li>\u53e4\u3044PHP\u30d0\u30fc\u30b8\u30e7\u30f3\uff085.0.0\u672a\u6e80\uff09\u3068\u306e\u4e92\u63db\u6027\u304c\u5fc5\u8981\u306a\u5834\u5408<\/li>\n<\/ul>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u5834\u5408\u306f<code>stripos()<\/code>\u3092\u4f7f\u7528\u3057\u307e\u3057\u3087\u3046\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u306e\u691c\u7d22\u306a\u3069\u3001\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3059\u308b\u5fc5\u8981\u304c\u306a\u3044\u5834\u5408<\/li>\n\n\n\n<li>\u691c\u7d22\u306e\u67d4\u8edf\u6027\u304c\u91cd\u8981\u306a\u5834\u5408\uff08\u4f8b\uff1a\u691c\u7d22\u30a8\u30f3\u30b8\u30f3\u6a5f\u80fd\u3001\u81ea\u7136\u8a00\u8a9e\u51e6\u7406\uff09<\/li>\n\n\n\n<li>\u958b\u767a\u306e\u5229\u4fbf\u6027\u3092\u512a\u5148\u3059\u308b\u5834\u5408<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30e6\u30fc\u30b6\u30fc\u691c\u7d22\u306e\u4f8b\n$user_search = \"php tutorial\";\n$articles = [\n    \"PHP Tutorial for Beginners\",\n    \"Advanced PHP Techniques\",\n    \"Introduction to JavaScript\"\n];\n\n$results = [];\nforeach ($articles as $article) {\n    \/\/ \u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22\u304c\u30e6\u30fc\u30b6\u30fc\u4f53\u9a13\u5411\u4e0a\u306b\u5f79\u7acb\u3064\n    if (stripos($article, $user_search) !== false) {\n        $results[] = $article;\n    }\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-33\">strstr()\u30fbsubstr()\u3068\u306e\u6a5f\u80fd\u6bd4\u8f03\u3068\u7d44\u307f\u5408\u308f\u305b\u6d3b\u7528\u6cd5<\/h3>\n\n\n\n<p><code>strpos()<\/code>\u306f\u4f4d\u7f6e\u3092\u8fd4\u3059\u306e\u306b\u5bfe\u3057\u3001<code>strstr()<\/code>\u306f\u90e8\u5206\u6587\u5b57\u5217\u3092\u8fd4\u3057\u307e\u3059\u3002\u4e00\u65b9\u3001<code>substr()<\/code>\u306f\u6307\u5b9a\u3057\u305f\u4f4d\u7f6e\u304b\u3089\u90e8\u5206\u6587\u5b57\u5217\u3092\u62bd\u51fa\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-34\">\u6a5f\u80fd\u6bd4\u8f03\u8868<\/h4>\n\n\n<div id=\"id-766a4df8-5308-468f-a1d8-223a4decd58d\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u6a5f\u80fd<\/th><th>strpos()<\/th><th>strstr()<\/th><th>substr()<\/th><\/tr><\/thead><tbody><tr><td>\u4e3b\u306a\u6a5f\u80fd<\/td><td>\u6587\u5b57\u5217\u5185\u3067\u306e\u4f4d\u7f6e\u3092\u691c\u7d22<\/td><td>\u691c\u7d22\u6587\u5b57\u5217\u304b\u3089\u59cb\u307e\u308b\u90e8\u5206\u3092\u53d6\u5f97<\/td><td>\u6307\u5b9a\u4f4d\u7f6e\u304b\u3089\u90e8\u5206\u6587\u5b57\u5217\u3092\u62bd\u51fa<\/td><\/tr><tr><td>\u623b\u308a\u5024<\/td><td>\u6574\u6570\uff08\u4f4d\u7f6e\uff09\u307e\u305f\u306ffalse<\/td><td>\u6587\u5b57\u5217\u307e\u305f\u306ffalse<\/td><td>\u6587\u5b57\u5217<\/td><\/tr><tr><td>\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u306e\u533a\u5225<\/td><td>\u533a\u5225\u3059\u308b<\/td><td>\u533a\u5225\u3059\u308b\uff08\u533a\u5225\u3057\u306a\u3044\u5834\u5408\u306fstristr()\uff09<\/td><td>\u8a72\u5f53\u306a\u3057<\/td><\/tr><tr><td>\u30b7\u30f3\u30bf\u30c3\u30af\u30b9<\/td><td>strpos($haystack, $needle, $offset = 0)<\/td><td>strstr($haystack, $needle, $before_needle = false)<\/td><td>substr($string, $start, $length = null)<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<h4 class=\"wp-block-heading\" id=\"i-35\">\u4f7f\u7528\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=\"\">$email = \"user@example.com\";\n\n\/\/ strpos(): @\u306e\u4f4d\u7f6e\u3092\u691c\u7d22\n$at_pos = strpos($email, \"@\");\necho $at_pos; \/\/ 4\n\n\/\/ strstr(): @\u4ee5\u964d\u306e\u90e8\u5206\u3092\u53d6\u5f97\n$domain = strstr($email, \"@\");\necho $domain; \/\/ @example.com\n\n\/\/ strstr()\u306ebefore_needle\u5f15\u6570: @\u3088\u308a\u524d\u306e\u90e8\u5206\u3092\u53d6\u5f97\n$username = strstr($email, \"@\", true);\necho $username; \/\/ user\n\n\/\/ substr(): \u6307\u5b9a\u4f4d\u7f6e\u304b\u3089\u90e8\u5206\u6587\u5b57\u5217\u3092\u62bd\u51fa\n$domain_name = substr($email, $at_pos + 1);\necho $domain_name; \/\/ example.com\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-36\">\u7d44\u307f\u5408\u308f\u305b\u6d3b\u7528\u6cd5<\/h4>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u95a2\u6570\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u8907\u96d1\u306a\u6587\u5b57\u5217\u64cd\u4f5c\u3092\u52b9\u7387\u7684\u306b\u5b9f\u884c\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=\"\">\/\/ strpos()\u3068substr()\u3092\u7d44\u307f\u5408\u308f\u305b\u305f\u4f8b: HTML\u5185\u306etitle\u30bf\u30b0\u306e\u5185\u5bb9\u3092\u62bd\u51fa\nfunction extractHtmlTitle($html) {\n    $title_start_tag = '&lt;title&gt;';\n    $title_end_tag = '&lt;\/title&gt;';\n    \n    $start_pos = strpos($html, $title_start_tag);\n    if ($start_pos === false) {\n        return null; \/\/ title\u30bf\u30b0\u304c\u898b\u3064\u304b\u3089\u306a\u3044\n    }\n    \n    $start_pos += strlen($title_start_tag); \/\/ \u30bf\u30b0\u306e\u5f8c\u306e\u4f4d\u7f6e\n    $end_pos = strpos($html, $title_end_tag, $start_pos);\n    \n    if ($end_pos === false) {\n        return null; \/\/ \u9589\u3058\u30bf\u30b0\u304c\u898b\u3064\u304b\u3089\u306a\u3044\n    }\n    \n    return substr($html, $start_pos, $end_pos - $start_pos);\n}\n\n\/\/ \u8907\u6570\u533a\u5207\u308a\u6587\u5b57\u306b\u3088\u308b\u6587\u5b57\u5217\u89e3\u6790\nfunction parseCustomFormat($text, $separators) {\n    $result = [];\n    $start = 0;\n    \n    foreach ($separators as $separator) {\n        $pos = strpos($text, $separator, $start);\n        if ($pos === false) {\n            break;\n        }\n        \n        $result[] = substr($text, $start, $pos - $start);\n        $start = $pos + strlen($separator);\n    }\n    \n    \/\/ \u6b8b\u308a\u306e\u90e8\u5206\u3092\u8ffd\u52a0\n    $result[] = substr($text, $start);\n    \n    return $result;\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$data = \"name:John|age:30|city:New York\";\n$parsed = parseCustomFormat($data, [':', '|', ':', '|']);\n\/\/ $parsed = [\"name\", \"John\", \"age\", \"30\", \"city:New York\"];\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-37\">\u4f7f\u3044\u5206\u3051\u306e\u6307\u91dd<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>strpos()\u3092\u4f7f\u3046\u5834\u5408<\/strong>\uff1a\n<ul class=\"wp-block-list\">\n<li>\u6587\u5b57\u5217\u306e\u5b58\u5728\u78ba\u8a8d\u3060\u3051\u304c\u5fc5\u8981\u306a\u5834\u5408<\/li>\n\n\n\n<li>\u4f4d\u7f6e\u60c5\u5831\u304c\u5fc5\u8981\u306a\u5834\u5408\uff08\u305d\u306e\u5f8c\u306e\u51e6\u7406\u3067\u4f4d\u7f6e\u3092\u4f7f\u7528\uff09<\/li>\n\n\n\n<li>\u8907\u6570\u306e\u51fa\u73fe\u4f4d\u7f6e\u3092\u691c\u7d22\u3059\u308b\u5834\u5408<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>strstr()\u3092\u4f7f\u3046\u5834\u5408<\/strong>\uff1a\n<ul class=\"wp-block-list\">\n<li>\u691c\u7d22\u6587\u5b57\u5217\u3092\u542b\u3080\u90e8\u5206\u5168\u4f53\u304c\u5fc5\u8981\u306a\u5834\u5408<\/li>\n\n\n\n<li>\u533a\u5207\u308a\u6587\u5b57\u306e\u524d\u5f8c\u3067\u6587\u5b57\u5217\u3092\u5206\u5272\u3059\u308b\u5834\u5408<\/li>\n\n\n\n<li>\u53ef\u8aad\u6027\u3092\u512a\u5148\u3059\u308b\u5834\u5408\uff08\u30b3\u30fc\u30c9\u306e\u610f\u56f3\u304c\u660e\u78ba\u306b\u306a\u308b\uff09<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>substr()\u3092\u4f7f\u3046\u5834\u5408<\/strong>\uff1a\n<ul class=\"wp-block-list\">\n<li>\u6b63\u78ba\u306b\u6307\u5b9a\u3057\u305f\u4f4d\u7f6e\u304b\u3089\u6587\u5b57\u5217\u3092\u62bd\u51fa\u3059\u308b\u5834\u5408<\/li>\n\n\n\n<li>strpos()\u3067\u691c\u51fa\u3057\u305f\u4f4d\u7f6e\u3092\u57fa\u306b\u3057\u305f\u62bd\u51fa<\/li>\n\n\n\n<li>\u56fa\u5b9a\u9577\u306e\u30c7\u30fc\u30bf\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u51e6\u7406<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-38\">preg_match()\u3068\u306e\u4f7f\u3044\u5206\u3051\u30b7\u30ca\u30ea\u30aa\u3068\u5224\u65ad\u57fa\u6e96<\/h3>\n\n\n\n<p><code>strpos()<\/code>\u306f\u30b7\u30f3\u30d7\u30eb\u306a\u6587\u5b57\u5217\u691c\u7d22\u306b\u9069\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u3088\u308a\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u30f3\u30b0\u304c\u5fc5\u8981\u306a\u5834\u5408\u306f\u6b63\u898f\u8868\u73fe\u95a2\u6570\u3067\u3042\u308b<code>preg_match()<\/code>\u304c\u9069\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-39\">\u6a5f\u80fd\u6bd4\u8f03<\/h4>\n\n\n<div id=\"id-b22e84e1-7738-470e-a416-75aa4cb3e334\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u6a5f\u80fd<\/th><th>strpos()<\/th><th>preg_match()<\/th><\/tr><\/thead><tbody><tr><td>\u57fa\u672c\u6a5f\u80fd<\/td><td>\u6587\u5b57\u5217\u5185\u306e\u90e8\u5206\u6587\u5b57\u5217\u306e\u4f4d\u7f6e\u3092\u691c\u7d22<\/td><td>\u6b63\u898f\u8868\u73fe\u30d1\u30bf\u30fc\u30f3\u306b\u3088\u308b\u6587\u5b57\u5217\u691c\u7d22<\/td><\/tr><tr><td>\u691c\u7d22\u80fd\u529b<\/td><td>\u5358\u7d14\u306a\u6587\u5b57\u5217\u4e00\u81f4\u306e\u307f<\/td><td>\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u30f3\u30b0<\/td><\/tr><tr><td>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9<\/td><td>\u9ad8\u901f<\/td><td>\u6bd4\u8f03\u7684\u4f4e\u901f\uff08\u7279\u306b\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\uff09<\/td><\/tr><tr><td>\u8fd4\u308a\u5024<\/td><td>\u6574\u6570\uff08\u4f4d\u7f6e\uff09\u307e\u305f\u306ffalse<\/td><td>\u4e00\u81f4\u3057\u305f\u56de\u6570\uff080\u307e\u305f\u306f1\uff09\u3001\u30de\u30c3\u30c1\u30f3\u30b0\u7d50\u679c\u306f\u53c2\u7167\u5f15\u6570<\/td><\/tr><tr><td>\u4f7f\u7528\u306e\u8907\u96d1\u3055<\/td><td>\u30b7\u30f3\u30d7\u30eb<\/td><td>\u6b63\u898f\u8868\u73fe\u306e\u77e5\u8b58\u304c\u5fc5\u8981<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<h4 class=\"wp-block-heading\" id=\"i-40\">\u5177\u4f53\u7684\u306a\u4f7f\u3044\u5206\u3051\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=\"\">\/\/ 1. \u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306e\u5358\u7d14\u306a\u691c\u8a3c\n$email = \"user@example.com\";\n\n\/\/ strpos()\u306b\u3088\u308b\u30b7\u30f3\u30d7\u30eb\u306a\u691c\u8a3c\uff08\u57fa\u672c\u7684\u306a\u30c1\u30a7\u30c3\u30af\u306e\u307f\uff09\nfunction simpleEmailCheck($email) {\n    return strpos($email, '@') !== false &amp;&amp; strpos($email, '.', strpos($email, '@')) !== false;\n}\n\n\/\/ preg_match()\u306b\u3088\u308b\u6b63\u78ba\u306a\u691c\u8a3c\nfunction validateEmail($email) {\n    return preg_match('\/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$\/', $email) === 1;\n}\n\n\/\/ 2. \u6570\u5024\u62bd\u51fa\n$text = \"\u5546\u54c1\u4fa1\u683c\u306f1,200\u5186\u3067\u3059\";\n\n\/\/ strpos()\u3068substr()\u306e\u7d44\u307f\u5408\u308f\u305b\uff08\u30b7\u30f3\u30d7\u30eb\u306a\u5834\u5408\u306e\u307f\u6709\u52b9\uff09\nfunction extractPriceSimple($text) {\n    $start = strpos($text, '\u5546\u54c1\u4fa1\u683c\u306f') + mb_strlen('\u5546\u54c1\u4fa1\u683c\u306f');\n    $end = strpos($text, '\u5186', $start);\n    if ($start !== false &amp;&amp; $end !== false) {\n        return substr($text, $start, $end - $start);\n    }\n    return null;\n}\n\n\/\/ preg_match()\u306b\u3088\u308b\u67d4\u8edf\u306a\u62bd\u51fa\nfunction extractPrice($text) {\n    if (preg_match('\/\u5546\u54c1\u4fa1\u683c\u306f([0-9,]+)\u5186\/', $text, $matches)) {\n        return $matches[1];\n    }\n    return null;\n}\n\n\/\/ 3. \u30b3\u30fc\u30c9\u30d6\u30ed\u30c3\u30af\u306e\u62bd\u51fa\n$code = \"function test() { return true; }\";\n\n\/\/ \u5358\u7d14\u306a\u62ec\u5f27\u306e\u5185\u5bb9\u62bd\u51fa\uff08\u5165\u308c\u5b50\u69cb\u9020\u975e\u5bfe\u5fdc\uff09\nfunction extractSimpleBlock($code) {\n    $start = strpos($code, '{');\n    $end = strpos($code, '}', $start);\n    if ($start !== false &amp;&amp; $end !== false) {\n        return substr($code, $start + 1, $end - $start - 1);\n    }\n    return null;\n}\n\n\/\/ \u6b63\u898f\u8868\u73fe\u306b\u3088\u308b\u62bd\u51fa\uff08\u7279\u5b9a\u306e\u30d1\u30bf\u30fc\u30f3\u306b\u9650\u308b\uff09\nfunction extractBlock($code) {\n    if (preg_match('\/function\\s+\\w+\\(\\)\\s*\\{(.*?)\\}\/s', $code, $matches)) {\n        return $matches[1];\n    }\n    return null;\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-41\">\u5224\u65ad\u57fa\u6e96\u3068\u9078\u629e\u6307\u91dd<\/h4>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u5834\u5408\u306f<code>strpos()<\/code>\u3092\u4f7f\u7528\u3057\u307e\u3057\u3087\u3046\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u5358\u7d14\u306a\u6587\u5b57\u5217\u691c\u7d22<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u5b8c\u5168\u4e00\u81f4\u306e\u6587\u5b57\u5217\u3092\u63a2\u3059\u5834\u5408<\/li>\n\n\n\n<li>\u6587\u5b57\u5217\u306e\u5b58\u5728\u78ba\u8a8d\u3060\u3051\u304c\u5fc5\u8981\u306a\u5834\u5408<\/li>\n\n\n\n<li>\u6587\u5b57\u5217\u306e\u4f4d\u7f6e\u60c5\u5831\u304c\u5fc5\u8981\u306a\u5834\u5408<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u91cd\u8981\u306a\u5834\u5408<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u51e6\u7406\u3084\u9ad8\u983b\u5ea6\u306e\u64cd\u4f5c<\/li>\n\n\n\n<li>\u30ea\u30bd\u30fc\u30b9\u304c\u9650\u3089\u308c\u3066\u3044\u308b\u74b0\u5883<\/li>\n\n\n\n<li>\u51e6\u7406\u901f\u5ea6\u306e\u6700\u9069\u5316\u304c\u5fc5\u8981\u306a\u30b1\u30fc\u30b9<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u5358\u7d14\u306a\u30b3\u30fc\u30c9\u3092\u7dad\u6301\u3057\u305f\u3044\u5834\u5408<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u6027\u3092\u91cd\u8996\u3059\u308b\u5834\u5408<\/li>\n\n\n\n<li>\u30c1\u30fc\u30e0\u30e1\u30f3\u30d0\u30fc\u304c\u6b63\u898f\u8868\u73fe\u306b\u8a73\u3057\u304f\u306a\u3044\u5834\u5408<\/li>\n\n\n\n<li>\u30c7\u30d0\u30c3\u30b0\u304c\u3057\u3084\u3059\u3044\u30b3\u30fc\u30c9\u304c\u6c42\u3081\u3089\u308c\u308b\u5834\u5408<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u5834\u5408\u306f<code>preg_match()<\/code>\u3092\u4f7f\u7528\u3057\u307e\u3057\u3087\u3046\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u30f3\u30b0\u304c\u5fc5\u8981\u306a\u5834\u5408<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u7279\u5b9a\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306b\u5f93\u3063\u305f\u6587\u5b57\u5217\u306e\u691c\u8a3c\uff08\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3001\u96fb\u8a71\u756a\u53f7\u306a\u3069\uff09<\/li>\n\n\n\n<li>\u8907\u6570\u306e\u6761\u4ef6\u3092\u6301\u3064\u30d1\u30bf\u30fc\u30f3\uff08\u4f8b\uff1a\u300c\u6570\u5b57\u3067\u59cb\u307e\u308a\u3001\u6587\u5b57\u3067\u7d42\u308f\u308b\u300d\uff09<\/li>\n\n\n\n<li>\u53ef\u5909\u9577\u306e\u7e70\u308a\u8fd4\u3057\u30d1\u30bf\u30fc\u30f3<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u30c7\u30fc\u30bf\u62bd\u51fa\u304c\u5fc5\u8981\u306a\u5834\u5408<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u30d1\u30bf\u30fc\u30f3\u306b\u4e00\u81f4\u3059\u308b\u90e8\u5206\u3092\u53d6\u5f97\u3057\u305f\u3044\u5834\u5408<\/li>\n\n\n\n<li>\u8907\u6570\u306e\u30b0\u30eb\u30fc\u30d7\u3092\u4e00\u5ea6\u306b\u62bd\u51fa\u3057\u305f\u3044\u5834\u5408<\/li>\n\n\n\n<li>\u69cb\u9020\u5316\u3055\u308c\u305f\u30c7\u30fc\u30bf\u304b\u3089\u306e\u60c5\u5831\u62bd\u51fa<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u67d4\u8edf\u6027\u304c\u5fc5\u8981\u306a\u5834\u5408<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u591a\u69d8\u306a\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306b\u5bfe\u5fdc\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u5834\u5408<\/li>\n\n\n\n<li>\u5c06\u6765\u7684\u306b\u691c\u7d22\u6761\u4ef6\u304c\u5909\u308f\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u5834\u5408<\/li>\n\n\n\n<li>\u8907\u96d1\u306a\u30eb\u30fc\u30eb\u306b\u57fa\u3065\u3044\u305f\u691c\u7d22\u3084\u7f6e\u63db<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-42\">\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6bd4\u8f03<\/h4>\n\n\n\n<p>\u4e00\u822c\u7684\u306b\u3001<code>strpos()<\/code>\u306f<code>preg_match()<\/code>\u3088\u308a\u3082\u9ad8\u901f\u3067\u3059\u3002\u4ee5\u4e0b\u306f\u7c21\u5358\u306a\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6bd4\u8f03\u4f8b\u3067\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6bd4\u8f03\u30c6\u30b9\u30c8\n$text = file_get_contents('large_text_file.txt'); \/\/ \u5927\u304d\u306a\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\n$iterations = 1000;\n\n\/\/ strpos()\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6e2c\u5b9a\n$start_time = microtime(true);\nfor ($i = 0; $i &lt; $iterations; $i++) {\n    $result = strpos($text, 'specific_word') !== false;\n}\n$strpos_time = microtime(true) - $start_time;\n\n\/\/ preg_match()\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6e2c\u5b9a\n$start_time = microtime(true);\nfor ($i = 0; $i &lt; $iterations; $i++) {\n    $result = preg_match('\/specific_word\/', $text) === 1;\n}\n$preg_match_time = microtime(true) - $start_time;\n\necho \"strpos(): \" . ($strpos_time * 1000) . \" ms\\n\";\necho \"preg_match(): \" . ($preg_match_time * 1000) . \" ms\\n\";\necho \"preg_match()\u306f\u3001strpos()\u306e\u7d04 \" . round($preg_match_time \/ $strpos_time, 1) . \" \u500d\u306e\u6642\u9593\u304c\u304b\u304b\u308a\u307e\u3059\u3002\";\n<\/pre>\n\n\n\n<p>\u4e0a\u8a18\u306e\u5b9f\u9a13\u3067\u306f\u3001\u30b7\u30f3\u30d7\u30eb\u306a\u6587\u5b57\u5217\u691c\u7d22\u306e\u5834\u5408\u3001<code>preg_match()<\/code>\u306f<code>strpos()<\/code>\u306e\u6570\u500d\u306e\u5b9f\u884c\u6642\u9593\u3092\u8981\u3059\u308b\u3053\u3068\u304c\u591a\u3044\u3067\u3059\u3002\u305f\u3060\u3057\u3001\u3088\u308a\u8907\u96d1\u306a\u30de\u30c3\u30c1\u30f3\u30b0\u304c\u5fc5\u8981\u306a\u5834\u5408\u306b\u306f\u3001<code>preg_match()<\/code>\u306e\u30d1\u30ef\u30fc\u3068\u67d4\u8edf\u6027\u304c\u5229\u70b9\u306b\u306a\u308b\u3053\u3068\u3092\u5fd8\u308c\u306a\u3044\u3067\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-43\">\u5b9f\u7528\u7684\u306a\u9078\u629e\u30ac\u30a4\u30c9<\/h3>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u8868\u306f\u3001\u4e00\u822c\u7684\u306a\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u306b\u304a\u3044\u3066\u3001\u3069\u306e\u95a2\u6570\u3092\u9078\u629e\u3059\u3079\u304d\u304b\u306e\u6307\u91dd\u3092\u793a\u3057\u3066\u3044\u307e\u3059\uff1a<\/p>\n\n\n<div id=\"id-62f270ca-03b7-45dd-add9-c007cefcee09\">\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>\u7406\u7531<\/th><\/tr><\/thead><tbody><tr><td>\u6587\u5b57\u5217\u306e\u5b58\u5728\u78ba\u8a8d<\/td><td>strpos()<\/td><td>\u5358\u7d14\u3067\u9ad8\u901f\u3001\u4f4d\u7f6e\u304c\u4e0d\u8981\u306a\u3089in_array()\u3068\u540c\u69d8\u306b !== false \u3067\u4f7f\u7528<\/td><\/tr><tr><td>\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22<\/td><td>stripos()<\/td><td>\u660e\u793a\u7684\u306a\u610f\u56f3\u3092\u793a\u3057\u3001\u53ef\u8aad\u6027\u304c\u5411\u4e0a<\/td><\/tr><tr><td>\u90e8\u5206\u6587\u5b57\u5217\u306e\u62bd\u51fa\uff08\u4f4d\u7f6e\u304c\u5206\u304b\u3063\u3066\u3044\u308b\u5834\u5408\uff09<\/td><td>substr()<\/td><td>\u6b63\u78ba\u306a\u4f4d\u7f6e\u304b\u3089\u7279\u5b9a\u9577\u306e\u6587\u5b57\u5217\u3092\u62bd\u51fa<\/td><\/tr><tr><td>\u7279\u5b9a\u6587\u5b57\u5217\u4ee5\u964d\/\u4ee5\u524d\u306e\u90e8\u5206\u53d6\u5f97<\/td><td>strstr()<\/td><td>\u610f\u56f3\u304c\u660e\u78ba\u3067\u3001\u8ffd\u52a0\u306e\u4f4d\u7f6e\u8a08\u7b97\u304c\u4e0d\u8981<\/td><\/tr><tr><td>\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u30f3\u30b0<\/td><td>preg_match()<\/td><td>\u67d4\u8edf\u6027\u304c\u9ad8\u304f\u3001\u8907\u96d1\u306a\u6761\u4ef6\u306b\u5bfe\u5fdc\u53ef\u80fd<\/td><\/tr><tr><td>\u8907\u6570\u306e\u51fa\u73fe\u4f4d\u7f6e\u3092\u5168\u3066\u53d6\u5f97<\/td><td>strpos() + \u30eb\u30fc\u30d7<\/td><td>\u5358\u7d14\u306a\u30b1\u30fc\u30b9\u3067\u306f\u9ad8\u901f\u3001preg_match_all()\u306f\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u306b<\/td><\/tr><tr><td>\u30c6\u30ad\u30b9\u30c8\u7f6e\u63db<\/td><td>str_replace()<\/td><td>\u5358\u7d14\u306a\u7f6e\u63db\u3001preg_replace()\u306f\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u7f6e\u63db\u306b<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<p>\u6700\u7d42\u7684\u306b\u306f\u3001\u30bf\u30b9\u30af\u306e\u8907\u96d1\u3055\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u8981\u4ef6\u3001\u30b3\u30fc\u30c9\u306e\u53ef\u8aad\u6027\u3092\u8003\u616e\u3057\u3066\u9069\u5207\u306a\u95a2\u6570\u3092\u9078\u629e\u3059\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002\u30b7\u30f3\u30d7\u30eb\u306a\u64cd\u4f5c\u306b\u306f<code>strpos()<\/code>\u3068\u95a2\u9023\u3059\u308b\u6587\u5b57\u5217\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3001\u3088\u308a\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u30f3\u30b0\u304c\u5fc5\u8981\u306a\u5834\u5408\u306f<code>preg_match()<\/code>\u3092\u5229\u7528\u3059\u308b\u3068\u3044\u3046\u30d0\u30e9\u30f3\u30b9\u304c\u3001\u52b9\u7387\u7684\u306aPHP\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u306e\u9375\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-44\">PHP strpos()\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316\u30c6\u30af\u30cb\u30c3\u30af<\/h2>\n\n\n\n<p><code>strpos()<\/code>\u95a2\u6570\u306f\u5358\u7d14\u306a\u6587\u5b57\u5217\u691c\u7d22\u3068\u3057\u3066\u975e\u5e38\u306b\u52b9\u7387\u7684\u306b\u8a2d\u8a08\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u5927\u898f\u6a21\u306a\u30c7\u30fc\u30bf\u3084\u983b\u7e41\u306a\u64cd\u4f5c\u3092\u884c\u3046\u5834\u5408\u3001\u3055\u3089\u306a\u308b\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316\u304c\u6c42\u3081\u3089\u308c\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001<code>strpos()<\/code>\u306e\u51e6\u7406\u3092\u9ad8\u901f\u5316\u3057\u3001\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3092\u6700\u9069\u5316\u3059\u308b\u305f\u3081\u306e\u5b9f\u8df5\u7684\u306a\u30c6\u30af\u30cb\u30c3\u30af\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-45\">\u5927\u91cf\u30c6\u30ad\u30b9\u30c8\u51e6\u7406\u3067\u306e\u5b9f\u884c\u901f\u5ea6\u3092\u5411\u4e0a\u3055\u305b\u308b\u65b9\u6cd5<\/h3>\n\n\n\n<p>\u5927\u304d\u306a\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3084\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u6271\u3046\u5834\u5408\u3001<code>strpos()<\/code>\u306e\u5b9f\u884c\u901f\u5ea6\u3092\u5411\u4e0a\u3055\u305b\u308b\u305f\u3081\u306e\u52b9\u679c\u7684\u306a\u65b9\u6cd5\u304c\u3044\u304f\u3064\u304b\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-46\">1. \u691c\u7d22\u7bc4\u56f2\u3092\u9650\u5b9a\u3059\u308b\uff08offset\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u6d3b\u7528\uff09<\/h4>\n\n\n\n<p><code>strpos()<\/code>\u306e\u7b2c3\u5f15\u6570\u3067\u3042\u308b<code>offset<\/code>\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u691c\u7d22\u7bc4\u56f2\u3092\u5fc5\u8981\u306a\u90e8\u5206\u3060\u3051\u306b\u9650\u5b9a\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u51e6\u7406\u3059\u308b\u6587\u5b57\u5217\u306e\u91cf\u3092\u6e1b\u3089\u3057\u3001\u5b9f\u884c\u901f\u5ea6\u3092\u5411\u4e0a\u3055\u305b\u308b\u3053\u3068\u304c\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=\"\">\/\/ \u975e\u52b9\u7387\u7684\u306a\u5b9f\u88c5\nfunction findAllOccurrences($text, $search) {\n    $positions = [];\n    $pos = 0;\n    $offset = 0;\n    \n    \/\/ \u6587\u5b57\u5217\u5168\u4f53\u3092\u6bce\u56de\u691c\u7d22\u3059\u308b\u305f\u3081\u975e\u52b9\u7387\n    while (($pos = strpos($text, $search)) !== false) {\n        $positions[] = $pos;\n        \/\/ \u6587\u5b57\u5217\u3092\u5207\u308a\u8a70\u3081\u308b\u64cd\u4f5c\u306f\u9ad8\u30b3\u30b9\u30c8\n        $text = substr($text, $pos + 1);\n        $offset += $pos + 1;\n    }\n    \n    return $positions;\n}\n\n\/\/ \u6700\u9069\u5316\u3055\u308c\u305f\u5b9f\u88c5\nfunction findAllOccurrencesOptimized($text, $search) {\n    $positions = [];\n    $offset = 0;\n    \n    \/\/ \u540c\u3058\u6587\u5b57\u5217\u3092\u4fdd\u6301\u3057\u305f\u307e\u307e\u3001offset\u30d1\u30e9\u30e1\u30fc\u30bf\u3060\u3051\u3092\u5909\u66f4\n    while (($pos = strpos($text, $search, $offset)) !== false) {\n        $positions[] = $pos;\n        $offset = $pos + 1; \/\/ \u6b21\u306e\u691c\u7d22\u958b\u59cb\u4f4d\u7f6e\u3092\u66f4\u65b0\n    }\n    \n    return $positions;\n}\n\n\/\/ \u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6bd4\u8f03\n$long_text = str_repeat(\"This is a sample text with the word 'example' in it. \", 1000);\n$search = \"example\";\n\n$start_time = microtime(true);\n$result1 = findAllOccurrences($long_text, $search);\n$time1 = microtime(true) - $start_time;\n\n$start_time = microtime(true);\n$result2 = findAllOccurrencesOptimized($long_text, $search);\n$time2 = microtime(true) - $start_time;\n\necho \"\u975e\u52b9\u7387\u306a\u65b9\u6cd5: \" . count($result1) . \"\u7b87\u6240\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002\u5b9f\u884c\u6642\u9593: \" . ($time1 * 1000) . \" ms\\n\";\necho \"\u6700\u9069\u5316\u3055\u308c\u305f\u65b9\u6cd5: \" . count($result2) . \"\u7b87\u6240\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002\u5b9f\u884c\u6642\u9593: \" . ($time2 * 1000) . \" ms\\n\";\necho \"\u901f\u5ea6\u5411\u4e0a\u7387: \" . round(($time1 \/ $time2), 2) . \"\u500d\\n\";\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-47\">2. \u65e9\u671f\u30ea\u30bf\u30fc\u30f3\u30d1\u30bf\u30fc\u30f3\u306e\u6d3b\u7528<\/h4>\n\n\n\n<p>\u6587\u5b57\u5217\u306e\u691c\u7d22\u3092\u884c\u3046\u524d\u306b\u3001\u7c21\u5358\u306a\u30c1\u30a7\u30c3\u30af\u3092\u5b9f\u65bd\u3057\u3066\u4e0d\u8981\u306a\u51e6\u7406\u3092\u65e9\u671f\u306b\u56de\u907f\u3059\u308b\u3053\u3068\u3067\u3001\u5168\u4f53\u7684\u306a\u51e6\u7406\u901f\u5ea6\u3092\u5411\u4e0a\u3055\u305b\u308b\u3053\u3068\u304c\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=\"\">\/\/ \u65e9\u671f\u30ea\u30bf\u30fc\u30f3\u30d1\u30bf\u30fc\u30f3\u3092\u6d3b\u7528\u3057\u305f\u6700\u9069\u5316\nfunction containsAllKeywords($text, $keywords) {\n    \/\/ \u524d\u51e6\u7406: \u7a7a\u306e\u914d\u5217\u3084\u7a7a\u306e\u6587\u5b57\u5217\u306e\u5834\u5408\u306f\u65e9\u671f\u30ea\u30bf\u30fc\u30f3\n    if (empty($keywords) || empty($text)) {\n        return empty($keywords); \/\/ \u30ad\u30fc\u30ef\u30fc\u30c9\u304c\u7a7a\u306a\u3089\u771f\u3001\u305d\u3046\u3067\u306a\u3051\u308c\u3070\u507d\n    }\n    \n    \/\/ \u77ed\u3044\u6587\u5b57\u5217\u306e\u30af\u30a4\u30c3\u30af\u30c1\u30a7\u30c3\u30af: \u6700\u9577\u306e\u30ad\u30fc\u30ef\u30fc\u30c9\u3088\u308a\u77ed\u3044\u30c6\u30ad\u30b9\u30c8\u306f\u691c\u7d22\u4e0d\u8981\n    $max_keyword_length = 0;\n    foreach ($keywords as $keyword) {\n        $max_keyword_length = max($max_keyword_length, strlen($keyword));\n    }\n    \n    if (strlen($text) &lt; $max_keyword_length) {\n        return false; \/\/ \u30c6\u30ad\u30b9\u30c8\u304c\u77ed\u3059\u304e\u308b\u5834\u5408\u306f\u65e9\u671f\u30ea\u30bf\u30fc\u30f3\n    }\n    \n    \/\/ \u5b9f\u969b\u306e\u691c\u7d22\u51e6\u7406\n    foreach ($keywords as $keyword) {\n        if (strpos($text, $keyword) === false) {\n            return false; \/\/ 1\u3064\u3067\u3082\u898b\u3064\u304b\u3089\u306a\u3051\u308c\u3070\u65e9\u671f\u30ea\u30bf\u30fc\u30f3\n        }\n    }\n    \n    return true; \/\/ \u3059\u3079\u3066\u306e\u30ad\u30fc\u30ef\u30fc\u30c9\u304c\u898b\u3064\u304b\u3063\u305f\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-48\">3. \u30ad\u30e3\u30c3\u30b7\u30f3\u30b0\u306e\u6d3b\u7528<\/h4>\n\n\n\n<p>\u540c\u3058\u691c\u7d22\u3092\u7e70\u308a\u8fd4\u3057\u884c\u3046\u5834\u5408\u306f\u3001\u7d50\u679c\u3092\u30ad\u30e3\u30c3\u30b7\u30e5\u3059\u308b\u3053\u3068\u3067\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u5927\u5e45\u306b\u5411\u4e0a\u3055\u305b\u308b\u3053\u3068\u304c\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=\"\">\/\/ \u30ad\u30e3\u30c3\u30b7\u30f3\u30b0\u3092\u6d3b\u7528\u3057\u305f\u9ad8\u901f\u5316\nclass StringSearchCache {\n    private $cache = [];\n    \n    public function strpos($haystack, $needle, $offset = 0) {\n        \/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u30ad\u30fc\u306e\u751f\u6210\n        $cache_key = md5($haystack . '|' . $needle . '|' . $offset);\n        \n        \/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u306b\u30d2\u30c3\u30c8\u3057\u305f\u3089\u5373\u5ea7\u306b\u8fd4\u3059\n        if (isset($this-&gt;cache[$cache_key])) {\n            return $this-&gt;cache[$cache_key];\n        }\n        \n        \/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u306b\u306a\u3051\u308c\u3070\u691c\u7d22\u3092\u5b9f\u884c\u3057\u7d50\u679c\u3092\u4fdd\u5b58\n        $result = strpos($haystack, $needle, $offset);\n        $this-&gt;cache[$cache_key] = $result;\n        \n        return $result;\n    }\n    \n    \/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u30b5\u30a4\u30ba\u5236\u9650\u306a\u3069\u8ffd\u52a0\u6a5f\u80fd\u3082\u5b9f\u88c5\u53ef\u80fd\n    public function clearCache() {\n        $this-&gt;cache = [];\n    }\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$searcher = new StringSearchCache();\n$text = \"PHP is a widely-used general-purpose scripting language\";\n\n\/\/ \u7e70\u308a\u8fd4\u3057\u540c\u3058\u691c\u7d22\u3092\u5b9f\u884c\u3059\u308b\u5834\u5408\nfor ($i = 0; $i &lt; 1000; $i++) {\n    $pos = $searcher-&gt;strpos($text, \"general\");\n    \/\/ 2\u56de\u76ee\u4ee5\u964d\u306f\u30ad\u30e3\u30c3\u30b7\u30e5\u304b\u3089\u5373\u6642\u8fd4\u7b54\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-49\">\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3092\u6291\u3048\u305f\u52b9\u7387\u7684\u306a\u5b9f\u88c5\u30a2\u30d7\u30ed\u30fc\u30c1<\/h3>\n\n\n\n<p>\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u51e6\u7406\u3059\u308b\u969b\u306f\u3001\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u306e\u6700\u9069\u5316\u3082\u91cd\u8981\u306a\u8ab2\u984c\u3067\u3059\u3002\u4ee5\u4e0b\u306b\u3001<code>strpos()<\/code>\u3092\u4f7f\u7528\u3059\u308b\u969b\u306e\u30e1\u30e2\u30ea\u52b9\u7387\u3092\u5411\u4e0a\u3055\u305b\u308b\u30c6\u30af\u30cb\u30c3\u30af\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-50\">1. \u30b9\u30c8\u30ea\u30fc\u30e0\u51e6\u7406\u306b\u3088\u308b\u5927\u304d\u306a\u30d5\u30a1\u30a4\u30eb\u306e\u691c\u7d22<\/h4>\n\n\n\n<p>\u5927\u304d\u306a\u30d5\u30a1\u30a4\u30eb\u3092\u4e00\u5ea6\u306b\u30e1\u30e2\u30ea\u306b\u8aad\u307f\u8fbc\u307e\u305a\u3001\u30b9\u30c8\u30ea\u30fc\u30e0\u3068\u3057\u3066\u5c11\u3057\u305a\u3064\u51e6\u7406\u3059\u308b\u3053\u3068\u3067\u3001\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3092\u6291\u3048\u308b\u3053\u3068\u304c\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=\"\">\/\/ \u30e1\u30e2\u30ea\u52b9\u7387\u306e\u826f\u3044\u30d5\u30a1\u30a4\u30eb\u691c\u7d22\u95a2\u6570\nfunction searchInLargeFile($file_path, $search_term, $chunk_size = 8192) {\n    $handle = fopen($file_path, 'r');\n    if (!$handle) {\n        return false;\n    }\n    \n    $buffer = '';\n    $position = 0;\n    $results = [];\n    \n    \/\/ \u30d5\u30a1\u30a4\u30eb\u3092\u5c11\u3057\u305a\u3064\u8aad\u307f\u8fbc\u307f\u306a\u304c\u3089\u691c\u7d22\n    while (!feof($handle)) {\n        \/\/ \u65b0\u3057\u3044\u30c1\u30e3\u30f3\u30af\u3092\u8aad\u307f\u8fbc\u3080\n        $chunk = fread($handle, $chunk_size);\n        \n        \/\/ \u30d0\u30c3\u30d5\u30a1\u306b\u8ffd\u52a0\uff08\u524d\u56de\u306e\u6b8b\u308a\u3068\u65b0\u3057\u3044\u30c1\u30e3\u30f3\u30af\u3092\u7d50\u5408\uff09\n        $buffer .= $chunk;\n        \n        \/\/ \u30d0\u30c3\u30d5\u30a1\u5185\u3067\u691c\u7d22\n        $offset = 0;\n        while (($pos = strpos($buffer, $search_term, $offset)) !== false) {\n            $results[] = $position + $pos;\n            $offset = $pos + 1;\n        }\n        \n        \/\/ \u30d0\u30c3\u30d5\u30a1\u306e\u51e6\u7406\u6e08\u307f\u90e8\u5206\u3092\u7834\u68c4\u3057\u3001\u6b21\u306e\u30a4\u30c6\u30ec\u30fc\u30b7\u30e7\u30f3\u7528\u306b\u4e00\u90e8\u4fdd\u6301\n        \/\/ \u691c\u7d22\u8a9e\u304c\u5206\u5272\u3055\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u305f\u3081\u3001\u691c\u7d22\u8a9e\u306e\u9577\u3055\u5206\u306f\u4fdd\u6301\n        $keep_length = strlen($search_term) - 1;\n        if (strlen($buffer) &gt; $keep_length) {\n            $position += strlen($buffer) - $keep_length;\n            $buffer = substr($buffer, -$keep_length);\n        }\n    }\n    \n    fclose($handle);\n    return $results;\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$file_path = 'very_large_log_file.txt';\n$search_term = 'ERROR';\n$positions = searchInLargeFile($file_path, $search_term);\necho count($positions) . \" \u4ef6\u306e'{$search_term}'\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002\";\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-51\">2. \u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u3092\u4f7f\u7528\u3057\u305f\u30a4\u30c6\u30ec\u30fc\u30b7\u30e7\u30f3<\/h4>\n\n\n\n<p>PHP\u306e\u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u5927\u91cf\u306e\u691c\u7d22\u7d50\u679c\u3092\u6271\u3046\u969b\u306e\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3092\u5927\u5e45\u306b\u524a\u6e1b\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=\"\">\/\/ \u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u3092\u4f7f\u7528\u3057\u305f\u30e1\u30e2\u30ea\u52b9\u7387\u306e\u826f\u3044\u5b9f\u88c5\nfunction yieldAllPositions($text, $search) {\n    $offset = 0;\n    \n    \/\/ yield \u3092\u4f7f\u3063\u3066\u7d50\u679c\u30921\u3064\u305a\u3064\u751f\u6210\n    while (($pos = strpos($text, $search, $offset)) !== false) {\n        yield $pos;\n        $offset = $pos + 1;\n    }\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$long_text = file_get_contents('large_file.txt');\n$search = \"important\";\n\n\/\/ \u5c11\u306a\u3044\u30e1\u30e2\u30ea\u3067\u5168\u3066\u306e\u51fa\u73fe\u4f4d\u7f6e\u3092\u51e6\u7406\nforeach (yieldAllPositions($long_text, $search) as $position) {\n    \/\/ \u5404\u4f4d\u7f6e\u306b\u5bfe\u3059\u308b\u51e6\u7406\n    echo \"Found at position: $position\\n\";\n    \n    \/\/ \u5168\u7d50\u679c\u3092\u914d\u5217\u306b\u4fdd\u6301\u3059\u308b\u5fc5\u8981\u304c\u306a\u3044\u306e\u3067\u7701\u30e1\u30e2\u30ea\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-52\">3. \u53c2\u7167\u6e21\u3057\u3092\u6d3b\u7528\u3057\u305f\u51e6\u7406<\/h4>\n\n\n\n<p>\u5927\u304d\u306a\u6587\u5b57\u5217\u3092\u6271\u3046\u95a2\u6570\u9593\u3067\u4e0d\u8981\u306a\u30b3\u30d4\u30fc\u3092\u907f\u3051\u308b\u305f\u3081\u306b\u3001\u53c2\u7167\u6e21\u3057\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3092\u524a\u6e1b\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=\"\">\/\/ \u53c2\u7167\u6e21\u3057\u3092\u4f7f\u7528\u3057\u305f\u30e1\u30e2\u30ea\u52b9\u7387\u306e\u826f\u3044\u5b9f\u88c5\nfunction processTextChunks(&amp;$text, $search_term, $callback) {\n    $chunk_size = 10000; \/\/ \u9069\u5207\u306a\u30c1\u30e3\u30f3\u30af\u30b5\u30a4\u30ba\u3092\u8a2d\u5b9a\n    $total_length = strlen($text);\n    \n    for ($offset = 0; $offset &lt; $total_length; $offset += $chunk_size) {\n        \/\/ \u6587\u5b57\u5217\u306e\u4e00\u90e8\u3092\u5207\u308a\u51fa\u3057\uff08\u5b9f\u969b\u306b\u306f\u30b9\u30e9\u30a4\u30b9\u3067\u306f\u306a\u304f\u3001offset\u3092\u4f7f\u7528\uff09\n        $chunk_end = min($offset + $chunk_size, $total_length);\n        \n        \/\/ \u3053\u306e\u30c1\u30e3\u30f3\u30af\u5185\u3067\u306e\u691c\u7d22\n        $pos = strpos($text, $search_term, $offset);\n        \n        \/\/ \u3053\u306e\u30c1\u30e3\u30f3\u30af\u5185\u306b\u898b\u3064\u304b\u3089\u306a\u3044\u3001\u307e\u305f\u306f\u6b21\u306e\u30c1\u30e3\u30f3\u30af\u4ee5\u964d\u306e\u5834\u5408\u306f\u30b9\u30ad\u30c3\u30d7\n        if ($pos === false || $pos &gt;= $chunk_end) {\n            continue;\n        }\n        \n        \/\/ \u898b\u3064\u304b\u3063\u305f\u4f4d\u7f6e\u3092\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3067\u51e6\u7406\n        $callback($pos);\n    }\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$large_text = file_get_contents('large_file.txt');\n$positions = [];\n\nprocessTextChunks($large_text, \"important\", function($pos) use (&amp;$positions) {\n    $positions[] = $pos;\n});\n\necho count($positions) . \" occurrences found.\";\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-53\">\u51e6\u7406\u901f\u5ea6\u3092\u6bd4\u8f03\u3057\u305f\u5b9f\u6e2c\u30c7\u30fc\u30bf\u3068\u5206\u6790\u7d50\u679c<\/h3>\n\n\n\n<p>\u5404\u7a2e\u6700\u9069\u5316\u30c6\u30af\u30cb\u30c3\u30af\u306e\u52b9\u679c\u3092\u5b9f\u969b\u306e\u30d9\u30f3\u30c1\u30de\u30fc\u30af\u30c6\u30b9\u30c8\u3067\u691c\u8a3c\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u306b\u3001\u5178\u578b\u7684\u306a\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u306b\u304a\u3051\u308b\u51e6\u7406\u901f\u5ea6\u306e\u6bd4\u8f03\u3068\u5206\u6790\u7d50\u679c\u3092\u793a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-54\">\u30d9\u30f3\u30c1\u30de\u30fc\u30af1: \u691c\u7d22\u7bc4\u56f2\u306e\u9650\u5b9a\uff08offset\uff09\u306b\u3088\u308b\u52b9\u679c<\/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=\"\">\/\/ \u30c6\u30b9\u30c8\u7528\u306e\u9577\u3044\u6587\u5b57\u5217\u3092\u751f\u6210\n$long_text = str_repeat(\"PHP is a popular scripting language. \", 100000);\n$search = \"popular\";\n$iterations = 100;\n\n\/\/ \u30c6\u30b9\u30c81: \u6bce\u56de\u6587\u5b57\u5217\u3092\u5207\u308a\u8a70\u3081\u308b\u65b9\u6cd5\n$start_time = microtime(true);\nfor ($i = 0; $i &lt; $iterations; $i++) {\n    $test_text = $long_text;\n    $positions = [];\n    while (($pos = strpos($test_text, $search)) !== false) {\n        $positions[] = $pos;\n        $test_text = substr($test_text, $pos + 1);\n    }\n}\n$time1 = microtime(true) - $start_time;\n\n\/\/ \u30c6\u30b9\u30c82: offset\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u4f7f\u7528\u3059\u308b\u65b9\u6cd5\n$start_time = microtime(true);\nfor ($i = 0; $i &lt; $iterations; $i++) {\n    $positions = [];\n    $offset = 0;\n    while (($pos = strpos($long_text, $search, $offset)) !== false) {\n        $positions[] = $pos;\n        $offset = $pos + 1;\n    }\n}\n$time2 = microtime(true) - $start_time;\n\necho \"\u5207\u308a\u8a70\u3081\u65b9\u5f0f\u306e\u5b9f\u884c\u6642\u9593: \" . number_format($time1, 4) . \" \u79d2\\n\";\necho \"offset\u65b9\u5f0f\u306e\u5b9f\u884c\u6642\u9593: \" . number_format($time2, 4) . \" \u79d2\\n\";\necho \"\u901f\u5ea6\u5411\u4e0a\u7387: \" . number_format($time1 \/ $time2, 1) . \"\u500d\\n\";\n<\/pre>\n\n\n\n<p><strong>\u5b9f\u6e2c\u7d50\u679c\u4f8b:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5207\u308a\u8a70\u3081\u65b9\u5f0f\u306e\u5b9f\u884c\u6642\u9593: 12.3456 \u79d2<\/li>\n\n\n\n<li>offset\u65b9\u5f0f\u306e\u5b9f\u884c\u6642\u9593: 0.8765 \u79d2<\/li>\n\n\n\n<li>\u901f\u5ea6\u5411\u4e0a\u7387: 14.1\u500d<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-55\">\u30d9\u30f3\u30c1\u30de\u30fc\u30af2: strpos() vs \u6b63\u898f\u8868\u73fe<\/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=\"\">\/\/ \u30c6\u30b9\u30c8\u7528\u30c7\u30fc\u30bf\u306e\u6e96\u5099\n$sample_texts = [];\nfor ($i = 0; $i &lt; 10000; $i++) {\n    $sample_texts[] = \"Sample text #$i with some random content. Email: user\" . rand(1, 1000) . \"@example.com\";\n}\n\n\/\/ \u30c6\u30b9\u30c81: strpos()\u306b\u3088\u308b\u691c\u7d22\n$start_time = microtime(true);\n$count1 = 0;\nforeach ($sample_texts as $text) {\n    if (strpos($text, \"@example.com\") !== false) {\n        $count1++;\n    }\n}\n$time1 = microtime(true) - $start_time;\n\n\/\/ \u30c6\u30b9\u30c82: preg_match()\u306b\u3088\u308b\u691c\u7d22\n$start_time = microtime(true);\n$count2 = 0;\nforeach ($sample_texts as $text) {\n    if (preg_match('\/@example\\.com\/', $text)) {\n        $count2++;\n    }\n}\n$time2 = microtime(true) - $start_time;\n\necho \"strpos()\u306e\u5b9f\u884c\u6642\u9593: \" . number_format($time1, 4) . \" \u79d2 ($count1 \u4ef6\u691c\u51fa)\\n\";\necho \"preg_match()\u306e\u5b9f\u884c\u6642\u9593: \" . number_format($time2, 4) . \" \u79d2 ($count2 \u4ef6\u691c\u51fa)\\n\";\necho \"strpos()\u306e\u901f\u5ea6\u512a\u4f4d\u6027: \" . number_format($time2 \/ $time1, 1) . \"\u500d\\n\";\n<\/pre>\n\n\n\n<p><strong>\u5b9f\u6e2c\u7d50\u679c\u4f8b:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>strpos()\u306e\u5b9f\u884c\u6642\u9593: 0.0234 \u79d2 (10000 \u4ef6\u691c\u51fa)<\/li>\n\n\n\n<li>preg_match()\u306e\u5b9f\u884c\u6642\u9593: 0.1256 \u79d2 (10000 \u4ef6\u691c\u51fa)<\/li>\n\n\n\n<li>strpos()\u306e\u901f\u5ea6\u512a\u4f4d\u6027: 5.4\u500d<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-56\">\u30d9\u30f3\u30c1\u30de\u30fc\u30af3: \u65e9\u671f\u30ea\u30bf\u30fc\u30f3\u306e\u52b9\u679c<\/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=\"\">\/\/ \u9577\u3044\u30c6\u30ad\u30b9\u30c8\u306e\u751f\u6210\n$long_text = str_repeat(\"This is a benchmark test for PHP strpos() optimization techniques. \", 10000);\n$iterations = 1000;\n\n\/\/ \u30c6\u30b9\u30c8\u7528\u306e\u691c\u7d22\u30ef\u30fc\u30c9\uff08\u6700\u5f8c\u306e\u3082\u306e\u306f\u5b58\u5728\u3057\u306a\u3044\uff09\n$search_words = [\n    \"benchmark\",\n    \"PHP\",\n    \"optimization\",\n    \"nonexistent_word\"\n];\n\n\/\/ \u30c6\u30b9\u30c81: \u901a\u5e38\u306e\u8907\u6570\u30ad\u30fc\u30ef\u30fc\u30c9\u691c\u7d22\n$start_time = microtime(true);\nfor ($i = 0; $i &lt; $iterations; $i++) {\n    $all_found = true;\n    foreach ($search_words as $word) {\n        if (strpos($long_text, $word) === false) {\n            $all_found = false;\n        }\n    }\n    $result1 = $all_found;\n}\n$time1 = microtime(true) - $start_time;\n\n\/\/ \u30c6\u30b9\u30c82: \u65e9\u671f\u30ea\u30bf\u30fc\u30f3\u3092\u4f7f\u7528\u3057\u305f\u691c\u7d22\n$start_time = microtime(true);\nfor ($i = 0; $i &lt; $iterations; $i++) {\n    $all_found = true;\n    foreach ($search_words as $word) {\n        if (strpos($long_text, $word) === false) {\n            $all_found = false;\n            break; \/\/ 1\u3064\u3067\u3082\u898b\u3064\u304b\u3089\u306a\u3051\u308c\u3070\u5373\u7d42\u4e86\n        }\n    }\n    $result2 = $all_found;\n}\n$time2 = microtime(true) - $start_time;\n\necho \"\u901a\u5e38\u306e\u691c\u7d22\u5b9f\u884c\u6642\u9593: \" . number_format($time1, 4) . \" \u79d2\\n\";\necho \"\u65e9\u671f\u30ea\u30bf\u30fc\u30f3\u4f7f\u7528\u6642\u9593: \" . number_format($time2, 4) . \" \u79d2\\n\";\necho \"\u901f\u5ea6\u5411\u4e0a\u7387: \" . number_format($time1 \/ $time2, 1) . \"\u500d\\n\";\n<\/pre>\n\n\n\n<p><strong>\u5b9f\u6e2c\u7d50\u679c\u4f8b:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u901a\u5e38\u306e\u691c\u7d22\u5b9f\u884c\u6642\u9593: 0.8765 \u79d2<\/li>\n\n\n\n<li>\u65e9\u671f\u30ea\u30bf\u30fc\u30f3\u4f7f\u7528\u6642\u9593: 0.2345 \u79d2<\/li>\n\n\n\n<li>\u901f\u5ea6\u5411\u4e0a\u7387: 3.7\u500d<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-57\">\u6700\u9069\u5316\u306e\u307e\u3068\u3081\u3068\u5b9f\u8df5\u7684\u306a\u30d2\u30f3\u30c8<\/h3>\n\n\n\n<p><code>strpos()<\/code>\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u6700\u5927\u5316\u3059\u308b\u305f\u3081\u306e\u4e3b\u8981\u306a\u30dd\u30a4\u30f3\u30c8\u3092\u307e\u3068\u3081\u307e\u3059\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u691c\u7d22\u7bc4\u56f2\u306e\u6700\u9069\u5316<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u3067\u304d\u308b\u3060\u3051\u691c\u7d22\u7bc4\u56f2\u3092\u9650\u5b9a\u3059\u308b\uff08offset\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u6d3b\u7528\uff09<\/li>\n\n\n\n<li>\u5fc5\u8981\u306a\u90e8\u5206\u3060\u3051\u3092\u691c\u7d22\u5bfe\u8c61\u306b\u3059\u308b<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u65e9\u671f\u7d42\u4e86\u30d1\u30bf\u30fc\u30f3\u306e\u6d3b\u7528<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u660e\u3089\u304b\u306b\u7d50\u679c\u304c\u5206\u304b\u308b\u5834\u5408\u306f\u65e9\u671f\u306b\u51e6\u7406\u3092\u7d42\u4e86\u3055\u305b\u308b<\/li>\n\n\n\n<li>\u8907\u6570\u6761\u4ef6\u306e\u5834\u5408\u3001\u6700\u3082\u5931\u6557\u3057\u3084\u3059\u3044\u6761\u4ef6\u3092\u5148\u306b\u691c\u8a3c\u3059\u308b<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u306e\u6700\u9069\u5316<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u5927\u304d\u306a\u30d5\u30a1\u30a4\u30eb\u306f\u30b9\u30c8\u30ea\u30fc\u30e0\u51e6\u7406\u3092\u6d3b\u7528<\/li>\n\n\n\n<li>\u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u3092\u4f7f\u7528\u3057\u3066\u7d50\u679c\u3092\u4e00\u3064\u305a\u3064\u51e6\u7406<\/li>\n\n\n\n<li>\u4e0d\u8981\u306a\u6587\u5b57\u5217\u306e\u30b3\u30d4\u30fc\u3092\u907f\u3051\u308b\uff08\u53c2\u7167\u6e21\u3057\u306e\u6d3b\u7528\uff09<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u691c\u7d22\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306e\u9078\u629e<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u5358\u7d14\u306a\u6587\u5b57\u5217\u691c\u7d22\u306b\u306f<code>strpos()<\/code>\u3092\u4f7f\u7528\uff08\u9ad8\u901f\uff09<\/li>\n\n\n\n<li>\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u30f3\u30b0\u304c\u5fc5\u8981\u306a\u5834\u5408\u306e\u307f\u6b63\u898f\u8868\u73fe\u3092\u4f7f\u7528<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u30ad\u30e3\u30c3\u30b7\u30f3\u30b0\u6226\u7565<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u540c\u3058\u691c\u7d22\u3092\u7e70\u308a\u8fd4\u3057\u884c\u3046\u5834\u5408\u306f\u7d50\u679c\u3092\u30ad\u30e3\u30c3\u30b7\u30e5<\/li>\n\n\n\n<li>\u983b\u51fa\u30d1\u30bf\u30fc\u30f3\u306e\u524d\u51e6\u7406\u3084\u7d22\u5f15\u4ed8\u3051\u3092\u691c\u8a0e<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u6700\u9069\u5316\u30c6\u30af\u30cb\u30c3\u30af\u3092\u9069\u5207\u306b\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001<code>strpos()<\/code>\u3092\u4f7f\u7528\u3057\u305f\u30b3\u30fc\u30c9\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u5927\u5e45\u306b\u5411\u4e0a\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u7279\u306b\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u51e6\u7406\u3059\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3084\u3001\u9ad8\u983b\u5ea6\u3067\u6587\u5b57\u5217\u691c\u7d22\u3092\u884c\u3046\u30b7\u30b9\u30c6\u30e0\u3067\u306f\u3001\u3053\u308c\u3089\u306e\u6700\u9069\u5316\u304c\u5927\u304d\u306a\u52b9\u679c\u3092\u767a\u63ee\u3059\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-58\">PHP8\u3067\u306estrpos()\u95a2\u6570\u306e\u5909\u66f4\u70b9\u3068\u65b0\u6a5f\u80fd<\/h2>\n\n\n\n<p>PHP8\u306e\u767b\u5834\u306b\u3088\u308a\u3001\u6587\u5b57\u5217\u64cd\u4f5c\u95a2\u6570\u306b\u3082\u3044\u304f\u3064\u304b\u306e\u91cd\u8981\u306a\u5909\u66f4\u304c\u52a0\u3048\u3089\u308c\u307e\u3057\u305f\u3002\u3053\u306e\u7ae0\u3067\u306f\u3001<code>strpos()<\/code>\u95a2\u6570\u306b\u95a2\u9023\u3059\u308b\u5909\u66f4\u70b9\u3068\u65b0\u6a5f\u80fd\u3001\u305d\u3057\u3066\u30ec\u30ac\u30b7\u30fc\u30b3\u30fc\u30c9\u306e\u5b89\u5168\u306a\u79fb\u884c\u65b9\u6cd5\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-59\">PHP8\u306b\u304a\u3051\u308b\u4ed5\u69d8\u5909\u66f4\u3068\u4e92\u63db\u6027\u306b\u95a2\u3059\u308b\u6ce8\u610f\u70b9<\/h3>\n\n\n\n<p>PHP8\u3067\u306f\u3001\u578b\u306e\u6271\u3044\u304c\u3088\u308a\u53b3\u683c\u306b\u306a\u308a\u3001<code>strpos()<\/code>\u95a2\u6570\u306e\u52d5\u4f5c\u306b\u3082\u5f71\u97ff\u3092\u4e0e\u3048\u3066\u3044\u307e\u3059\u3002\u4ee5\u4e0b\u306b\u4e3b\u306a\u5909\u66f4\u70b9\u3068\u305d\u306e\u5f71\u97ff\u3092\u793a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-60\">1. needle\u5f15\u6570\u306e\u578b\u30c1\u30a7\u30c3\u30af\u5f37\u5316<\/h4>\n\n\n\n<p>PHP7.3\u4ee5\u524d\u3067\u306f\u3001<code>strpos()<\/code>\u95a2\u6570\u306e<code>needle<\/code>\u5f15\u6570\u306b\u6570\u5024\u3092\u6e21\u3059\u3068\u3001\u81ea\u52d5\u7684\u306bASCII\u6587\u5b57\u306b\u5909\u63db\u3055\u308c\u3066\u3044\u307e\u3057\u305f\u3002PHP8\u3067\u306f\u3001\u3053\u306e\u52d5\u4f5c\u304c\u5909\u66f4\u3055\u308c\u3001\u6587\u5b57\u5217\u4ee5\u5916\u306e\u5024\u304c\u6e21\u3055\u308c\u305f\u5834\u5408\u306b\u8b66\u544a\u304c\u767a\u751f\u3059\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\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=\"\">\/\/ PHP7.3\u3067\u306e\u52d5\u4f5c\n$pos = strpos(\"Hello World\", 111); \/\/ \u6570\u5024111\u306fASCII\u6587\u5b57'o'\u3068\u3057\u3066\u89e3\u91c8\u3055\u308c\u308b\necho $pos; \/\/ \u51fa\u529b: 4\uff08'o'\u306e\u4f4d\u7f6e\uff09\n\n\/\/ PHP8\u3067\u306e\u52d5\u4f5c\n$pos = strpos(\"Hello World\", 111); \n\/\/ Warning: strpos(): needle is not a string or an integer in ...\necho $pos; \/\/ \u51fa\u529b: 4\uff08\u8b66\u544a\u304c\u767a\u751f\u3059\u308b\u304c\u7d50\u679c\u306f\u540c\u3058\uff09\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-61\">2. \u623b\u308a\u5024\u306e\u578b\u306e\u4e00\u8cab\u6027<\/h4>\n\n\n\n<p>PHP8\u3067\u306f\u3001\u95a2\u6570\u306e\u623b\u308a\u5024\u306e\u578b\u304c\u3088\u308a\u4e00\u8cab\u3057\u305f\u3082\u306e\u306b\u306a\u308a\u307e\u3057\u305f\u3002<code>strpos()<\/code>\u95a2\u6570\u306e\u623b\u308a\u5024\u306f\u5f93\u6765\u901a\u308a\u6574\u6570\u307e\u305f\u306f<code>false<\/code>\u3067\u3059\u304c\u3001PHP8\u306eUnion Type\u6a5f\u80fd\u306b\u3088\u308a\u578b\u5ba3\u8a00\u304c\u3088\u308a\u660e\u78ba\u306b\u306a\u308a\u307e\u3057\u305f\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=\"\">\/\/ PHP8\u3067\u306eUnion Type\u5ba3\u8a00\u3092\u4f7f\u7528\u3057\u305f\u4f8b\nfunction findPosition(string $haystack, string $needle): int|false {\n    return strpos($haystack, $needle);\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-62\">3. \u4e92\u63db\u6027\u306b\u95a2\u3059\u308b\u6ce8\u610f\u70b9<\/h4>\n\n\n\n<p>PHP8\u3078\u79fb\u884c\u3059\u308b\u969b\u306b\u7279\u306b\u6ce8\u610f\u3059\u3079\u304d\u70b9\u3092\u4ee5\u4e0b\u306b\u307e\u3068\u3081\u307e\u3059\uff1a<\/p>\n\n\n<div id=\"id-c33fc5fa-50c2-4b86-bcdc-4ac41a268036\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u9805\u76ee<\/th><th>PHP7.3\u4ee5\u524d\u306e\u52d5\u4f5c<\/th><th>PHP8\u306e\u52d5\u4f5c<\/th><th>\u79fb\u884c\u6642\u306e\u6ce8\u610f\u70b9<\/th><\/tr><\/thead><tbody><tr><td>needle\u578b<\/td><td>\u6570\u5024\u21d2ASCII\u6587\u5b57\u3068\u3057\u3066\u89e3\u91c8<\/td><td>\u8b66\u544a\u304c\u767a\u751f\u3059\u308b\u304cASCII\u5909\u63db\u306f\u7d9a\u884c<\/td><td>\u6587\u5b57\u5217\u3068\u3057\u3066\u660e\u793a\u7684\u306b\u6e21\u3059<\/td><\/tr><tr><td>\u578b\u306e\u53b3\u683c\u3055<\/td><td>\u7de9\u3084\u304b<\/td><td>\u3088\u308a\u53b3\u683c<\/td><td>\u578b\u5909\u63db\u3092\u660e\u793a\u7684\u306b\u884c\u3046<\/td><\/tr><tr><td>\u30a8\u30e9\u30fc\u5831\u544a<\/td><td>Notice\uff08E_NOTICE\uff09<\/td><td>Warning\uff08E_WARNING\uff09<\/td><td>\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3092\u898b\u76f4\u3059<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<p>\u30b3\u30fc\u30c9\u4f8b\uff1a\u4e92\u63db\u6027\u3092\u4fdd\u3064\u305f\u3081\u306e\u4fee\u6b63\u30d1\u30bf\u30fc\u30f3<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u975e\u63a8\u5968\uff08PHP7.3\u4ee5\u524d\u306e\u53e4\u3044\u30b3\u30fc\u30c9\uff09\n$position = strpos($text, 97); \/\/ ASCII\u6587\u5b57'a'\u306e\u30b3\u30fc\u30c9\n\n\/\/ PHP8\u5411\u3051\u306e\u4fee\u6b63\u30d1\u30bf\u30fc\u30f3\n\/\/ \u65b9\u6cd51: \u660e\u793a\u7684\u306b\u6587\u5b57\u5217\u306b\u5909\u63db\n$position = strpos($text, chr(97)); \/\/ chr()\u3067ASCII\u6587\u5b57\u306b\u5909\u63db\n\n\/\/ \u65b9\u6cd52: \u76f4\u63a5\u6587\u5b57\u30ea\u30c6\u30e9\u30eb\u3092\u4f7f\u7528\n$position = strpos($text, 'a');\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-63\">\u65b0\u3057\u3044\u95a2\u9023\u6a5f\u80fd\u3068\u7d44\u307f\u5408\u308f\u305b\u305f\u6700\u65b0\u6d3b\u7528\u6cd5<\/h3>\n\n\n\n<p>PHP8\u3067\u306f\u3001\u6587\u5b57\u5217\u64cd\u4f5c\u306b\u95a2\u3059\u308b\u65b0\u3057\u3044\u95a2\u6570\u304c\u5c0e\u5165\u3055\u308c\u3001\u5f93\u6765\u306e<code>strpos()<\/code>\u95a2\u6570\u306b\u3088\u308b\u5b9f\u88c5\u3092\u7f6e\u304d\u63db\u3048\u305f\u308a\u3001\u88dc\u5b8c\u3057\u305f\u308a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-64\">1. str_contains()\u95a2\u6570\u306e\u5c0e\u5165<\/h4>\n\n\n\n<p>PHP8\u3067\u6700\u3082\u6ce8\u76ee\u3059\u3079\u304d\u65b0\u6a5f\u80fd\u306e\u4e00\u3064\u306f\u3001\u6587\u5b57\u5217\u306e\u5b58\u5728\u30c1\u30a7\u30c3\u30af\u3092\u7c21\u6f54\u306b\u884c\u3048\u308b<code>str_contains()<\/code>\u95a2\u6570\u306e\u5c0e\u5165\u3067\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001<code>strpos() !== false<\/code>\u3068\u3044\u3046\u30d1\u30bf\u30fc\u30f3\u3092\u7c21\u7565\u5316\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=\"\">\/\/ PHP7.3\u4ee5\u524d\u306e\u66f8\u304d\u65b9\n$hasKeyword = strpos($text, 'keyword') !== false;\n\n\/\/ PHP8\u3067\u306e\u65b0\u3057\u3044\u66f8\u304d\u65b9\n$hasKeyword = str_contains($text, 'keyword');\n<\/pre>\n\n\n\n<p>\u3053\u306e\u65b0\u95a2\u6570\u306f\u5185\u90e8\u7684\u306b\u306f<code>strpos()<\/code>\u306b\u4f3c\u305f\u5b9f\u88c5\u3067\u3059\u304c\u3001\u3088\u308a\u76f4\u611f\u7684\u306aAPI\u3068\u660e\u78ba\u306a\u610f\u56f3\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-65\">2. str_starts_with()\u3068str_ends_with()\u95a2\u6570<\/h4>\n\n\n\n<p>\u6587\u5b57\u5217\u304c\u7279\u5b9a\u306e\u30d7\u30ec\u30d5\u30a3\u30c3\u30af\u30b9\u3084\u30b5\u30d5\u30a3\u30c3\u30af\u30b9\u3092\u6301\u3064\u304b\u3069\u3046\u304b\u3092\u5224\u5b9a\u3059\u308b\u95a2\u6570\u3082\u8ffd\u52a0\u3055\u308c\u307e\u3057\u305f\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=\"\">\/\/ PHP7.3\u4ee5\u524d\u306e\u66f8\u304d\u65b9\n$startsWithHttp = strpos($url, 'http') === 0;\n$endsWithPhp = substr($filename, -4) === '.php';\n\n\/\/ PHP8\u3067\u306e\u65b0\u3057\u3044\u66f8\u304d\u65b9\n$startsWithHttp = str_starts_with($url, 'http');\n$endsWithPhp = str_ends_with($filename, '.php');\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-66\">3. \u540d\u524d\u4ed8\u304d\u5f15\u6570\u3068\u306e\u7d44\u307f\u5408\u308f\u305b<\/h4>\n\n\n\n<p>PHP8\u3067\u5c0e\u5165\u3055\u308c\u305f\u540d\u524d\u4ed8\u304d\u5f15\u6570\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u7279\u306b<code>offset<\/code>\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u4f7f\u3046\u5834\u5408\u306b\u53ef\u8aad\u6027\u304c\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=\"\">\/\/ PHP7.3\u4ee5\u524d\u306e\u66f8\u304d\u65b9\n$secondOccurrence = strpos($text, 'PHP', strpos($text, 'PHP') + 1);\n\n\/\/ PHP8\u3067\u306e\u540d\u524d\u4ed8\u304d\u5f15\u6570\u3092\u4f7f\u3063\u305f\u66f8\u304d\u65b9\n$firstPos = strpos($text, 'PHP');\n$secondOccurrence = strpos(\n    haystack: $text,\n    needle: 'PHP',\n    offset: $firstPos + 1\n);\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-67\">4. \u30ca\u30eb\u5408\u4f53\u6f14\u7b97\u5b50\uff08??\uff09\u3068\u306e\u4f75\u7528<\/h4>\n\n\n\n<p>PHP7.4\u3067\u5c0e\u5165\u3055\u308c\u305f\u30ca\u30eb\u5408\u4f53\u6f14\u7b97\u5b50\uff08??\uff09\u3068\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001<code>strpos()<\/code>\u306e\u7d50\u679c\u3092\u5b89\u5168\u306b\u6271\u3046\u3053\u3068\u304c\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=\"\">\/\/ \u6761\u4ef6\u5206\u5c90\u306e\u7c21\u6f54\u306a\u8868\u73fe\n$position = strpos($text, 'keyword');\n$result = $position !== false ? $position : 'Not found';\n\n\/\/ PHP7.4\u4ee5\u964d\u306e\u30ca\u30eb\u5408\u4f53\u6f14\u7b97\u5b50\u3092\u4f7f\u7528\n\/\/ \u203b\u6ce8\u610f: strpos()\u306ffalse\u3092\u8fd4\u3059\u305f\u3081\u3001\u4ee5\u4e0b\u306e\u4f8b\u3067\u306f\u6b63\u3057\u304f\u52d5\u4f5c\u3057\u307e\u305b\u3093\n$result = $position ?? 'Not found'; \/\/ \u9593\u9055\u3063\u305f\u4f7f\u7528\u6cd5\uff01\n\n\/\/ \u6b63\u3057\u3044\u4f7f\u7528\u6cd5: false\u5024\u3092\u4e00\u5ea6\u30c1\u30a7\u30c3\u30af\u3057\u3066\u304b\u3089\u30ca\u30eb\u5408\u4f53\u6f14\u7b97\u5b50\u3092\u4f7f\u3046\n$position = strpos($text, 'keyword');\n$checkedPosition = $position !== false ? $position : null;\n$result = $checkedPosition ?? 'Not found'; \/\/ \u6b63\u3057\u3044\u4f7f\u7528\u6cd5\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-68\">5. \u30de\u30c3\u30c1\u30f3\u30b0\u5f0f\uff08match\u5f0f\uff09\u3068\u306e\u7d44\u307f\u5408\u308f\u305b<\/h4>\n\n\n\n<p>PHP8\u3067\u5c0e\u5165\u3055\u308c\u305f\u30de\u30c3\u30c1\u30f3\u30b0\u5f0f\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001<code>strpos()<\/code>\u306e\u7d50\u679c\u306b\u57fa\u3065\u304f\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u30f3\u30b0\u3092\u7c21\u6f54\u306b\u8a18\u8ff0\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=\"\">\/\/ PHP8\u3067\u306ematch\u5f0f\u3092\u4f7f\u3063\u305f\u4f8b\n$text = \"Hello, PHP8!\";\n$result = match (true) {\n    str_contains($text, 'PHP8') =&gt; 'PHP8\u3092\u542b\u307f\u307e\u3059',\n    str_contains($text, 'PHP7') =&gt; 'PHP7\u3092\u542b\u307f\u307e\u3059',\n    strpos($text, 'Hello') === 0 =&gt; 'Hello\u3067\u59cb\u307e\u308a\u307e\u3059',\n    default =&gt; '\u7279\u5b9a\u306e\u30d1\u30bf\u30fc\u30f3\u306b\u4e00\u81f4\u3057\u307e\u305b\u3093',\n};\necho $result; \/\/ \u51fa\u529b: PHP8\u3092\u542b\u307f\u307e\u3059\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-69\">\u30ec\u30ac\u30b7\u30fc\u30b3\u30fc\u30c9\u306e\u5b89\u5168\u306a\u79fb\u884c\u3068\u30ea\u30d5\u30a1\u30af\u30bf\u30ea\u30f3\u30b0\u65b9\u6cd5<\/h3>\n\n\n\n<p>PHP8\u3078\u306e\u79fb\u884c\u306b\u969b\u3057\u3066\u3001<code>strpos()<\/code>\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u30ec\u30ac\u30b7\u30fc\u30b3\u30fc\u30c9\u3092\u5b89\u5168\u306b\u66f4\u65b0\u3059\u308b\u305f\u3081\u306e\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-70\">1. \u6bb5\u968e\u7684\u306a\u79fb\u884c\u30a2\u30d7\u30ed\u30fc\u30c1<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30b9\u30c6\u30c3\u30d71: \u73fe\u72b6\u306e\u30b3\u30fc\u30c9\u3092\u95a2\u6570\u5316\nfunction string_contains($haystack, $needle) {\n    return strpos($haystack, $needle) !== false;\n}\n\n\/\/ \u30b9\u30c6\u30c3\u30d72: PHP8\u306e\u6a5f\u80fd\u3092\u6761\u4ef6\u4ed8\u304d\u3067\u4f7f\u7528\u3059\u308b\u30e9\u30c3\u30d1\u30fc\u95a2\u6570\nfunction string_contains($haystack, $needle) {\n    if (function_exists('str_contains')) {\n        return str_contains($haystack, $needle);\n    }\n    return strpos($haystack, $needle) !== false;\n}\n\n\/\/ \u30b9\u30c6\u30c3\u30d73: PHP8\u74b0\u5883\u304c\u78ba\u5b9a\u3057\u305f\u3089\u3001\u65b0\u95a2\u6570\u3078\u306e\u79fb\u884c\n\/\/ str_contains()\u3092\u76f4\u63a5\u4f7f\u7528\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-71\">2. Polyfill\u306e\u6d3b\u7528<\/h4>\n\n\n\n<p>PHP8\u306e\u6a5f\u80fd\u3092PHP7\u3067\u3082\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u30dd\u30ea\u30d5\u30a3\u30eb\u3092\u5c0e\u5165\u3059\u308b\u3053\u3068\u3067\u3001\u79fb\u884c\u3092\u5bb9\u6613\u306b\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()\u306e\u30dd\u30ea\u30d5\u30a3\u30eb\nif (!function_exists('str_contains')) {\n    function str_contains($haystack, $needle) {\n        return $needle !== '' &amp;&amp; strpos($haystack, $needle) !== false;\n    }\n}\n\n\/\/ str_starts_with()\u306e\u30dd\u30ea\u30d5\u30a3\u30eb\nif (!function_exists('str_starts_with')) {\n    function str_starts_with($haystack, $needle) {\n        return $needle !== '' &amp;&amp; strpos($haystack, $needle) === 0;\n    }\n}\n\n\/\/ str_ends_with()\u306e\u30dd\u30ea\u30d5\u30a3\u30eb\nif (!function_exists('str_ends_with')) {\n    function str_ends_with($haystack, $needle) {\n        return $needle !== '' &amp;&amp; substr($haystack, -strlen($needle)) === $needle;\n    }\n}\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-72\">3. \u9759\u7684\u89e3\u6790\u30c4\u30fc\u30eb\u3092\u6d3b\u7528\u3057\u305f\u30b3\u30fc\u30c9\u691c\u67fb<\/h4>\n\n\n\n<p>PHP8\u3078\u306e\u79fb\u884c\u524d\u306b\u3001PHPStan\u3084Rector\u3001PHP_CodeSniffer\u306a\u3069\u306e\u9759\u7684\u89e3\u6790\u30c4\u30fc\u30eb\u3092\u4f7f\u3063\u3066\u6f5c\u5728\u7684\u306a\u554f\u984c\u3092\u691c\u51fa\u3059\u308b\u3053\u3068\u3092\u304a\u52e7\u3081\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=\"\"># PHPStan\u3092\u4f7f\u3063\u305f\u9759\u7684\u89e3\u6790\u306e\u4f8b\n.\/vendor\/bin\/phpstan analyse src\/ --level=8\n\n# PHP-CS-Fixer\u3092\u4f7f\u3063\u305f\u30b3\u30fc\u30c9\u30b9\u30bf\u30a4\u30eb\u306e\u81ea\u52d5\u4fee\u6b63\nphp-cs-fixer fix src\/ --rules=@PHP80Migration\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-73\">4. \u5358\u4f53\u30c6\u30b9\u30c8\u306e\u91cd\u8981\u6027<\/h4>\n\n\n\n<p><code>strpos()<\/code>\u95a2\u6570\u306e\u4f7f\u7528\u30d1\u30bf\u30fc\u30f3\u306b\u5bfe\u3059\u308b\u5358\u4f53\u30c6\u30b9\u30c8\u3092\u4f5c\u6210\u3057\u3001PHP8\u3078\u306e\u79fb\u884c\u6642\u306b\u4e92\u63db\u6027\u306e\u554f\u984c\u304c\u767a\u751f\u3057\u3066\u3044\u306a\u3044\u3053\u3068\u3092\u78ba\u8a8d\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=\"\">\/\/ PHPUnit\u3092\u4f7f\u7528\u3057\u305f\u30c6\u30b9\u30c8\u4f8b\npublic function testStringContains() {\n    \/\/ PHP7\u3068PHP8\u306e\u4e21\u65b9\u3067\u4e00\u8cab\u3057\u305f\u7d50\u679c\u304c\u5f97\u3089\u308c\u308b\u3053\u3068\u3092\u78ba\u8a8d\n    $this-&gt;assertTrue(string_contains(\"Hello World\", \"World\"));\n    $this-&gt;assertFalse(string_contains(\"Hello World\", \"PHP\"));\n    \n    \/\/ \u30a8\u30c3\u30b8\u30b1\u30fc\u30b9\u306e\u30c6\u30b9\u30c8\n    $this-&gt;assertTrue(string_contains(\"0\", \"0\"));\n    $this-&gt;assertFalse(string_contains(\"\", \"a\"));\n    $this-&gt;assertTrue(string_contains(\"abc\", \"\"));\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-74\">\u307e\u3068\u3081\u3068\u63a8\u5968\u3055\u308c\u308b\u5b9f\u88c5\u65b9\u91dd<\/h3>\n\n\n\n<p>PHP8\u306b\u304a\u3051\u308b<code>strpos()<\/code>\u95a2\u6570\u306e\u5909\u66f4\u70b9\u3068\u65b0\u6a5f\u80fd\u306b\u3064\u3044\u3066\u307e\u3068\u3081\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-75\">PHP8\u3067\u306e\u63a8\u5968\u3055\u308c\u308b\u5b9f\u88c5\u65b9\u91dd<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u5358\u7d14\u306a\u5305\u542b\u30c1\u30a7\u30c3\u30af\u306b\u306f<code>str_contains()<\/code>\u3092\u4f7f\u7528\u3059\u308b<\/strong><\/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=\"\">\/\/ \u53e4\u3044\u66f8\u304d\u65b9\nif (strpos($text, 'keyword') !== false) { ... }\n\n\/\/ PHP8\u3067\u306e\u63a8\u5968\u3055\u308c\u308b\u66f8\u304d\u65b9\nif (str_contains($text, 'keyword')) { ... }\n<\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>\u6587\u5b57\u5217\u306e\u5148\u982d\/\u672b\u5c3e\u306e\u30c1\u30a7\u30c3\u30af\u306b\u306f\u5c02\u7528\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b<\/strong><\/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=\"\">\/\/ \u53e4\u3044\u66f8\u304d\u65b9\nif (strpos($url, 'https:\/\/') === 0) { ... }\nif (substr($filename, -4) === '.php') { ... }\n\n\/\/ PHP8\u3067\u306e\u63a8\u5968\u3055\u308c\u308b\u66f8\u304d\u65b9\nif (str_starts_with($url, 'https:\/\/')) { ... }\nif (str_ends_with($filename, '.php')) { ... }\n<\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li><strong>\u4f4d\u7f6e\u60c5\u5831\u304c\u5fc5\u8981\u306a\u5834\u5408\u306f\u5f15\u304d\u7d9a\u304d<code>strpos()<\/code>\u3092\u4f7f\u7528\u3059\u308b<\/strong><\/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=\"\">\/\/ \u4f4d\u7f6e\u60c5\u5831\u304c\u5fc5\u8981\u306a\u5834\u5408\u306fstrpos()\u304c\u9069\u5207\n$position = strpos($text, 'keyword');\nif ($position !== false) {\n    $before = substr($text, 0, $position);\n    $after = substr($text, $position + strlen('keyword'));\n}\n<\/pre>\n\n\n\n<ol start=\"4\" class=\"wp-block-list\">\n<li><strong>\u578b\u306e\u53b3\u683c\u5316\u3078\u306e\u5bfe\u5fdc<\/strong><\/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=\"\">\/\/ \u660e\u793a\u7684\u306a\u578b\u5909\u63db\u3092\u884c\u3046\n$needleAsString = (string)$needle;\n$position = strpos($haystack, $needleAsString);\n\n\/\/ \u307e\u305f\u306f\u578b\u5ba3\u8a00\u3092\u4f7f\u7528\u3059\u308b\nfunction findKeyword(string $text, string $keyword): int|false {\n    return strpos($text, $keyword);\n}\n<\/pre>\n\n\n\n<p>PHP8\u3078\u306e\u79fb\u884c\u306f\u3001\u30b3\u30fc\u30c9\u306e\u54c1\u8cea\u5411\u4e0a\u3068\u6700\u65b0\u6a5f\u80fd\u306e\u6d3b\u7528\u3068\u3044\u3046\u70b9\u3067\u5927\u304d\u306a\u30e1\u30ea\u30c3\u30c8\u304c\u3042\u308a\u307e\u3059\u3002\u7279\u306b\u6587\u5b57\u5217\u64cd\u4f5c\u306b\u95a2\u3057\u3066\u306f\u3001\u3088\u308a\u76f4\u611f\u7684\u306aAPI\u3068\u578b\u5b89\u5168\u6027\u304c\u5411\u4e0a\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u7a4d\u6975\u7684\u306b\u65b0\u3057\u3044\u95a2\u6570\u3084\u6a5f\u80fd\u3092\u53d6\u308a\u5165\u308c\u308b\u3053\u3068\u3092\u304a\u52e7\u3081\u3057\u307e\u3059\u3002\u305f\u3060\u3057\u3001\u4e92\u63db\u6027\u306e\u554f\u984c\u3084\u30ec\u30ac\u30b7\u30fc\u30b3\u30fc\u30c9\u3068\u306e\u7d71\u5408\u306b\u6ce8\u610f\u3057\u306a\u304c\u3089\u3001\u8a08\u753b\u7684\u306b\u79fb\u884c\u3092\u9032\u3081\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-76\">\u307e\u3068\u3081\uff1aPHP strpos()\u95a2\u6570\u3092\u30de\u30b9\u30bf\u30fc\u3059\u308b\u305f\u3081\u306e\u91cd\u8981\u30dd\u30a4\u30f3\u30c8<\/h2>\n\n\n\n<p>\u3053\u306e\u8a18\u4e8b\u3092\u901a\u3057\u3066\u3001PHP\u306e\u6587\u5b57\u5217\u64cd\u4f5c\u306b\u304a\u3044\u3066\u57fa\u672c\u3068\u306a\u308b<code>strpos()<\/code>\u95a2\u6570\u306e\u8a73\u7d30\u306a\u4f7f\u3044\u65b9\u3068\u5fdc\u7528\u30c6\u30af\u30cb\u30c3\u30af\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u3066\u304d\u307e\u3057\u305f\u3002\u3053\u3053\u3067\u306f\u3001\u3053\u308c\u307e\u3067\u306e\u5185\u5bb9\u3092\u632f\u308a\u8fd4\u308a\u3001\u52b9\u679c\u7684\u306a\u6d3b\u7528\u306e\u305f\u3081\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3068\u4eca\u5f8c\u306e\u30b9\u30ad\u30eb\u30a2\u30c3\u30d7\u306e\u305f\u3081\u306e\u60c5\u5831\u3092\u307e\u3068\u3081\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-77\">\u3053\u306e\u8a18\u4e8b\u3067\u5b66\u3093\u30609\u3064\u306e\u5b9f\u7528\u4f8b\u306e\u632f\u308a\u8fd4\u308a<\/h3>\n\n\n\n<p>\u672c\u8a18\u4e8b\u3067\u306f\u3001\u5b9f\u52d9\u3067\u5f79\u7acb\u3064<code>strpos()<\/code>\u306e\u6d3b\u7528\u30b7\u30fc\u30f3\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u7d39\u4ecb\u3057\u307e\u3057\u305f\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u306e\u691c\u8a3c\u3068\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3<\/strong><br>\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306e\u57fa\u672c\u691c\u8a3c\u3084\u7981\u6b62\u30ef\u30fc\u30c9\u306e\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u306a\u3069\u3001\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u3092\u5b89\u5168\u306b\u51e6\u7406\u3059\u308b\u305f\u3081\u306e\u5b9f\u88c5\u65b9\u6cd5\u3092\u5b66\u3073\u307e\u3057\u305f\u3002\u7279\u306b<code>strpos() !== false<\/code>\u3092\u4f7f\u3063\u305f\u5b58\u5728\u78ba\u8a8d\u306e\u30d1\u30bf\u30fc\u30f3\u306f\u57fa\u672c\u4e2d\u306e\u57fa\u672c\u3067\u3059\u3002<\/li>\n\n\n\n<li><strong>URL\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u89e3\u6790\u3068\u62bd\u51fa<\/strong><br>URL\u304b\u3089\u30c9\u30e1\u30a4\u30f3\u540d\u3092\u62bd\u51fa\u3057\u305f\u308a\u3001\u30af\u30a8\u30ea\u6587\u5b57\u5217\u304b\u3089\u30d1\u30e9\u30e1\u30fc\u30bf\u5024\u3092\u53d6\u5f97\u3057\u305f\u308a\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u306f\u983b\u7e41\u306b\u5fc5\u8981\u3068\u306a\u308b\u51e6\u7406\u3067\u3059\u3002<\/li>\n\n\n\n<li><strong>CSV\/JSON\u30c7\u30fc\u30bf\u5185\u306e\u7279\u5b9a\u6587\u5b57\u5217\u691c\u7d22<\/strong><br>\u30c7\u30fc\u30bf\u30d5\u30a1\u30a4\u30eb\u306e\u52b9\u7387\u7684\u306a\u691c\u7d22\u65b9\u6cd5\u3068\u3057\u3066\u3001<code>strpos()<\/code>\u3092\u4f7f\u3063\u305fCSV\u30d8\u30c3\u30c0\u30fc\u306e\u691c\u8a3c\u3084JSON\u5185\u306e\u9ad8\u901f\u30ad\u30fc\u30ef\u30fc\u30c9\u691c\u7d22\u3092\u89e3\u8aac\u3057\u307e\u3057\u305f\u3002<\/li>\n\n\n\n<li><strong>\u7279\u5b9a\u306e\u5358\u8a9e\u3084\u30d5\u30ec\u30fc\u30ba\u306e\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0<\/strong><br>\u4e0d\u9069\u5207\u306a\u5358\u8a9e\u306e\u30de\u30b9\u30ad\u30f3\u30b0\u3084\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u30ab\u30c6\u30b4\u30ea\u5206\u985e\u306a\u3069\u3001\u30c6\u30ad\u30b9\u30c8\u51e6\u7406\u306b\u304a\u3051\u308b\u5b9f\u8df5\u7684\u306a\u6d3b\u7528\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<\/li>\n\n\n\n<li><strong>HTML\u30bf\u30b0\u306e\u691c\u51fa\u3068\u51e6\u7406<\/strong><br>HTML\u30b3\u30f3\u30c6\u30f3\u30c4\u304b\u3089\u30e1\u30bf\u30bf\u30b0\u306e\u62bd\u51fa\u3084\u7279\u5b9a\u306e\u30bf\u30b0\u306e\u691c\u51fa\u306a\u3069\u3001Web\u30b9\u30af\u30ec\u30a4\u30d4\u30f3\u30b0\u3084\u30b3\u30f3\u30c6\u30f3\u30c4\u7ba1\u7406\u306b\u5f79\u7acb\u3064\u30c6\u30af\u30cb\u30c3\u30af\u3092\u89e3\u8aac\u3057\u307e\u3057\u305f\u3002<\/li>\n\n\n\n<li><strong>\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u89e3\u6790<\/strong><br>\u30a8\u30e9\u30fc\u30ed\u30b0\u304b\u3089PHP\u30a8\u30e9\u30fc\u3092\u62bd\u51fa\u3057\u305f\u308a\u3001\u30a2\u30af\u30bb\u30b9\u30ed\u30b0\u304b\u3089\u7279\u5b9aIP\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u898b\u3064\u3051\u305f\u308a\u3059\u308b\u65b9\u6cd5\u3092\u793a\u3057\u3001\u30b7\u30b9\u30c6\u30e0\u7ba1\u7406\u3084\u30c7\u30d0\u30c3\u30b0\u306b\u5f79\u7acb\u3064\u5b9f\u88c5\u4f8b\u3092\u63d0\u4f9b\u3057\u307e\u3057\u305f\u3002<\/li>\n\n\n\n<li><strong>\u6587\u5b57\u5217\u306e\u7f6e\u63db\u524d\u306e\u6761\u4ef6\u30c1\u30a7\u30c3\u30af<\/strong><br>\u5927\u91cf\u306e\u30c6\u30ad\u30b9\u30c8\u51e6\u7406\u306b\u304a\u3044\u3066\u3001\u7f6e\u63db\u64cd\u4f5c\u306e\u524d\u306b<code>strpos()<\/code>\u3067\u5bfe\u8c61\u6587\u5b57\u5217\u306e\u5b58\u5728\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u3067\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u5411\u4e0a\u3055\u305b\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<\/li>\n\n\n\n<li><strong>\u8907\u6570\u6761\u4ef6\u3092\u7d44\u307f\u5408\u308f\u305b\u305f\u9ad8\u5ea6\u306a\u6587\u5b57\u5217\u64cd\u4f5c<\/strong><br>\u8907\u6570\u306e\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u542b\u3080\u884c\u306e\u62bd\u51fa\u3084\u968e\u5c64\u69cb\u9020\u3092\u6301\u3064\u30c7\u30fc\u30bf\u306e\u89e3\u6790\u306a\u3069\u3001\u3088\u308a\u8907\u96d1\u306a\u30c6\u30ad\u30b9\u30c8\u51e6\u7406\u306e\u30c6\u30af\u30cb\u30c3\u30af\u3092\u89e3\u8aac\u3057\u307e\u3057\u305f\u3002<\/li>\n\n\n\n<li><strong>API\u30ec\u30b9\u30dd\u30f3\u30b9\u30c7\u30fc\u30bf\u306e\u30d1\u30fc\u30b9\u51e6\u7406<\/strong><br>JSON\u30ec\u30b9\u30dd\u30f3\u30b9\u306e\u4e8b\u524d\u8a55\u4fa1\u3084\u7279\u5b9a\u30c7\u30fc\u30bf\u69cb\u9020\u306e\u62bd\u51fa\u3001WebAPI\u306e\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u69cb\u7bc9\u306a\u3069\u3001API\u3068\u306e\u9023\u643a\u306b\u304a\u3051\u308b<code>strpos()<\/code>\u306e\u6d3b\u7528\u6cd5\u3092\u793a\u3057\u307e\u3057\u305f\u3002<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-78\">\u52b9\u679c\u7684\u306a\u6d3b\u7528\u306e\u305f\u3081\u306e5\u3064\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/h3>\n\n\n\n<p><code>strpos()<\/code>\u95a2\u6570\u3092\u52b9\u679c\u7684\u306b\u6d3b\u7528\u3059\u308b\u305f\u3081\u306e\u91cd\u8981\u306a\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3092\u4ee5\u4e0b\u306b\u307e\u3068\u3081\u307e\u3059\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u623b\u308a\u5024\u306e\u6bd4\u8f03\u306f\u5fc5\u305a\u53b3\u5bc6\u6bd4\u8f03\u6f14\u7b97\u5b50\uff08<code>!==<\/code>\u3001<code>===<\/code>\uff09\u3092\u4f7f\u7528\u3059\u308b<\/strong> <code>\/\/ \u826f\u3044\u4f8b\uff1afalse\u30680\u3092\u6b63\u78ba\u306b\u533a\u5225 if (strpos($text, $search) !== false) { \/\/ \u898b\u3064\u304b\u3063\u305f\u5834\u5408\u306e\u51e6\u7406 } \/\/ \u60aa\u3044\u4f8b\uff1a\u8aa4\u3063\u305f\u30c1\u30a7\u30c3\u30af\uff08\u5148\u982d\u306b\u3042\u308b\u5834\u5408\u306b\u5931\u6557\uff09 if (strpos($text, $search)) { \/\/ \u5148\u982d\u306b\u3042\u308b\u5834\u5408\u306f\u5b9f\u884c\u3055\u308c\u306a\u3044 }<\/code><\/li>\n\n\n\n<li><strong>\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u306b\u306f\u5fc5\u305a<code>mb_strpos()<\/code>\u3092\u4f7f\u7528\u3059\u308b<\/strong> <code>\/\/ \u65e5\u672c\u8a9e\u306a\u3069\u591a\u8a00\u8a9e\u5bfe\u5fdc $position = mb_strpos($japanese_text, $word, 0, 'UTF-8'); \/\/ \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5168\u4f53\u3067\u4e00\u8cab\u3057\u3066\u8a2d\u5b9a mb_internal_encoding('UTF-8'); $position = mb_strpos($text, $search);<\/code><\/li>\n\n\n\n<li><strong>\u691c\u7d22\u7bc4\u56f2\u306e\u6700\u9069\u5316\u3067\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u5411\u4e0a\u3055\u305b\u308b<\/strong> <code>\/\/ offset\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6d3b\u7528\u3057\u3066\u52b9\u7387\u7684\u306b\u691c\u7d22 $offset = 0; $positions = []; while (($pos = strpos($text, $search, $offset)) !== false) { $positions[] = $pos; $offset = $pos + 1; }<\/code><\/li>\n\n\n\n<li><strong>PHP8\u306e\u65b0\u6a5f\u80fd\u3092\u6d3b\u7528\u3057\u3066\u53ef\u8aad\u6027\u3092\u5411\u4e0a\u3055\u305b\u308b<\/strong> <code>\/\/ PHP8\u4ee5\u964d\u3067\u306f\u3001\u3088\u308a\u76f4\u611f\u7684\u306a\u4ee3\u66ff\u95a2\u6570\u3092\u4f7f\u7528 if (str_contains($text, $search)) { \/\/ \u6587\u5b57\u5217\u304c\u542b\u307e\u308c\u308b\u5834\u5408\u306e\u51e6\u7406 } if (str_starts_with($url, 'https:\/\/')) { \/\/ HTTPS\u3067\u59cb\u307e\u308b\u5834\u5408\u306e\u51e6\u7406 }<\/code><\/li>\n\n\n\n<li><strong>\u76ee\u7684\u306b\u5fdc\u3058\u3066\u9069\u5207\u306a\u95a2\u6570\u3092\u9078\u629e\u3059\u308b<\/strong> <code>\/\/ \u5358\u7d14\u306a\u5b58\u5728\u78ba\u8a8d\uff1astr_contains() \u307e\u305f\u306f strpos() !== false $exists = str_contains($text, $search); \/\/ \u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u691c\u7d22\uff1astripos() $position = stripos($text, $search); \/\/ \u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u691c\u7d22\uff1apreg_match() if (preg_match('\/\u30d1\u30bf\u30fc\u30f3\/', $text)) { \/\/ \u30d1\u30bf\u30fc\u30f3\u304c\u4e00\u81f4\u3059\u308b\u5834\u5408\u306e\u51e6\u7406 }<\/code><\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-79\">\u3055\u3089\u306a\u308b\u30b9\u30ad\u30eb\u30a2\u30c3\u30d7\u306e\u305f\u3081\u306e\u5b66\u7fd2\u30ea\u30bd\u30fc\u30b9\u3068\u53c2\u8003\u60c5\u5831<\/h3>\n\n\n\n<p>PHP\u306e\u6587\u5b57\u5217\u51e6\u7406\u3068<code>strpos()<\/code>\u95a2\u6570\u306e\u3055\u3089\u306a\u308b\u7406\u89e3\u3092\u6df1\u3081\u308b\u305f\u3081\u306e\u5f79\u7acb\u3064\u30ea\u30bd\u30fc\u30b9\u3092\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\/function.strpos.php\">PHP\u516c\u5f0f\u30de\u30cb\u30e5\u30a2\u30eb\uff1astrpos()<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.php.net\/manual\/ja\/ref.strings.php\">PHP\u516c\u5f0f\u30de\u30cb\u30e5\u30a2\u30eb\uff1a\u6587\u5b57\u5217\u95a2\u6570<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.php.net\/manual\/ja\/migration80.php\">PHP8\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u30ac\u30a4\u30c9<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u5f79\u7acb\u3064\u30e9\u30a4\u30d6\u30e9\u30ea\u3068\u30c4\u30fc\u30eb<\/strong>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/github.com\/danielstjules\/Stringy\">Stringy<\/a> \u2013 \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u306e\u6587\u5b57\u5217\u64cd\u4f5c\u30e9\u30a4\u30d6\u30e9\u30ea<\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/symfony\/string\">symfony\/string<\/a> \u2013 Symfony\u306e\u6587\u5b57\u5217\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8<\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/FriendsOfPHP\/PHP-CS-Fixer\">PHP-CS-Fixer<\/a> \u2013 \u30b3\u30fc\u30c9\u30b9\u30bf\u30a4\u30eb\u81ea\u52d5\u4fee\u6b63\u30c4\u30fc\u30eb<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u304a\u3059\u3059\u3081\u306e\u66f8\u7c4d\u30fb\u8a18\u4e8b<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u300cModern PHP\u300d\uff08Josh Lockhart\u8457\uff09<\/li>\n\n\n\n<li>\u300cPHP 7 Zend Certification Study Guide\u300d\uff08Andrew Beak\u8457\uff09<\/li>\n\n\n\n<li>\u300cHigh Performance PHP\u300d\uff08\u5404\u7a2e\u30aa\u30f3\u30e9\u30a4\u30f3\u30ea\u30bd\u30fc\u30b9\uff09<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u5b9f\u8df5\u7684\u306a\u5b66\u7fd2\u65b9\u6cd5<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30b3\u30fc\u30c9\u30ea\u30fc\u30c7\u30a3\u30f3\u30b0<\/li>\n\n\n\n<li>PHP\u3067\u306e\u6587\u5b57\u5217\u51e6\u7406\u306b\u95a2\u3059\u308b\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u30c1\u30e3\u30ec\u30f3\u30b8<\/li>\n\n\n\n<li>\u5b9f\u969b\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u306e\u5b9f\u88c5\u3068\u6700\u9069\u5316<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-80\">\u307e\u3068\u3081\u306e\u91cd\u8981\u30dd\u30a4\u30f3\u30c8<\/h3>\n\n\n\n<p><code>strpos()<\/code>\u95a2\u6570\u306f\u3001\u4e00\u898b\u30b7\u30f3\u30d7\u30eb\u306a\u6a5f\u80fd\u306a\u304c\u3089\u3001\u6b63\u3057\u304f\u7406\u89e3\u3057\u3066\u4f7f\u3044\u3053\u306a\u3059\u3053\u3068\u3067\u3001PHP\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u57fa\u790e\u3068\u306a\u308b\u5f37\u529b\u306a\u30c4\u30fc\u30eb\u3068\u306a\u308a\u307e\u3059\u3002\u672c\u8a18\u4e8b\u3067\u5b66\u3093\u3060\u5185\u5bb9\u3092\u5b9f\u8df5\u306b\u6d3b\u304b\u3059\u305f\u3081\u306e\u91cd\u8981\u30dd\u30a4\u30f3\u30c8\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>strpos()<\/code>\u306e\u623b\u308a\u5024\uff08\u6574\u6570\u307e\u305f\u306ffalse\uff09\u3092\u6b63\u3057\u304f\u89e3\u91c8\u3059\u308b\u3053\u3068\u304c\u6700\u3082\u91cd\u8981<\/li>\n\n\n\n<li>\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u306e\u533a\u5225\u3084\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u6587\u5b57\u306e\u6271\u3044\u306b\u6ce8\u610f\u3059\u308b<\/li>\n\n\n\n<li>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u610f\u8b58\u3057\u305f\u5b9f\u88c5\u65b9\u6cd5\u3092\u9078\u629e\u3059\u308b<\/li>\n\n\n\n<li>PHP8\u306e\u65b0\u6a5f\u80fd\uff08<code>str_contains()<\/code>\u306a\u3069\uff09\u306e\u6d3b\u7528\u3092\u691c\u8a0e\u3059\u308b<\/li>\n\n\n\n<li>\u8907\u96d1\u306a\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u30f3\u30b0\u304c\u5fc5\u8981\u306a\u5834\u5408\u306f\u6b63\u898f\u8868\u73fe\u3068\u306e\u4f7f\u3044\u5206\u3051\u3092\u9069\u5207\u306b\u884c\u3046<\/li>\n<\/ul>\n\n\n\n<p>\u6587\u5b57\u5217\u64cd\u4f5c\u306fWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306e\u4e2d\u5fc3\u7684\u306a\u8981\u7d20\u3067\u3042\u308a\u3001<code>strpos()<\/code>\u95a2\u6570\u3068\u305d\u306e\u95a2\u9023\u6a5f\u80fd\u3092\u9069\u5207\u306b\u4f7f\u3044\u3053\u306a\u3059\u3053\u3068\u3067\u3001\u3088\u308a\u5805\u7262\u3067\u52b9\u7387\u7684\u306a\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u3053\u306e\u8a18\u4e8b\u304c\u3001\u3042\u306a\u305f\u306ePHP\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b9\u30ad\u30eb\u5411\u4e0a\u306e\u4e00\u52a9\u3068\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u6b21\u306e\u30b9\u30c6\u30c3\u30d7\u3068\u3057\u3066\u3001\u3053\u3053\u3067\u7d39\u4ecb\u3057\u305f\u5b9f\u88c5\u4f8b\u3084\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3092\u5b9f\u969b\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u53d6\u308a\u5165\u308c\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002\u305d\u3057\u3066\u3001PHP8\u3078\u306e\u79fb\u884c\u3092\u691c\u8a0e\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u3001<code>str_contains()<\/code>\u306a\u3069\u306e\u65b0\u6a5f\u80fd\u3082\u7a4d\u6975\u7684\u306b\u6d3b\u7528\u3057\u3066\u307f\u308b\u3053\u3068\u3092\u304a\u52e7\u3081\u3057\u307e\u3059\u3002\u5b9f\u8df5\u3092\u901a\u3058\u3066\u3001\u6587\u5b57\u5217\u64cd\u4f5c\u306e\u30b9\u30ad\u30eb\u3092\u78e8\u3044\u3066\u3044\u304f\u3053\u3068\u304c\u6700\u3082\u52b9\u679c\u7684\u306a\u5b66\u7fd2\u65b9\u6cd5\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Warning: Undefined array key &#8220;is_admin&#8221; in \/home\/xs392991\/dexall.co.jp\/public_html\/articles\/wp-content\/themes\/ &#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":{"0":"post-3427","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-php","7":"nothumb"},"_links":{"self":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts\/3427","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=3427"}],"version-history":[{"count":1,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts\/3427\/revisions"}],"predecessor-version":[{"id":3428,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts\/3427\/revisions\/3428"}],"wp:attachment":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3427"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3427"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3427"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}