{"id":3723,"date":"2025-04-17T12:05:02","date_gmt":"2025-04-17T03:05:02","guid":{"rendered":"https:\/\/dexall.co.jp\/articles\/?p=3723"},"modified":"2025-04-17T12:05:04","modified_gmt":"2025-04-17T03:05:04","slug":"%e3%80%90php%e5%85%a5%e9%96%80%e3%80%91%e9%85%8d%e5%88%97%e8%a6%81%e7%b4%a0%e6%95%b0%e3%81%ae%e3%82%ab%e3%82%a6%e3%83%b3%e3%83%88%e3%83%bb%e6%93%8d%e4%bd%9c%e3%82%92%e5%be%b9%e5%ba%95%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/dexall.co.jp\/articles\/?p=3723","title":{"rendered":"\u3010PHP\u5165\u9580\u3011\u914d\u5217\u8981\u7d20\u6570\u306e\u30ab\u30a6\u30f3\u30c8\u30fb\u64cd\u4f5c\u3092\u5fb9\u5e95\u89e3\u8aac\uff017\u3064\u306e\u52b9\u7387\u7684\u30c6\u30af\u30cb\u30c3\u30af"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\" id=\"i-0\">\u3010PHP\u5165\u9580\u3011\u914d\u5217\u8981\u7d20\u6570\u306e\u30ab\u30a6\u30f3\u30c8\u30fb\u64cd\u4f5c\u3092\u5fb9\u5e95\u89e3\u8aac\uff017\u3064\u306e\u52b9\u7387\u7684\u30c6\u30af\u30cb\u30c3\u30af<\/h1>\n\n\n\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 last\">    <a href=\"#i-0\">\u3010PHP\u5165\u9580\u3011\u914d\u5217\u8981\u7d20\u6570\u306e\u30ab\u30a6\u30f3\u30c8\u30fb\u64cd\u4f5c\u3092\u5fb9\u5e95\u89e3\u8aac\uff017\u3064\u306e\u52b9\u7387\u7684\u30c6\u30af\u30cb\u30c3\u30af<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-1\">PHP\u306e\u914d\u5217\u3068\u8981\u7d20\u6570\u306e\u57fa\u790e\u77e5\u8b58<\/a>      <\/li>      <li>        <a href=\"#i-4\">\u914d\u5217\u306e\u8981\u7d20\u6570\u3092\u53d6\u5f97\u3059\u308b\u57fa\u672c\u7684\u306a\u65b9\u6cd5<\/a>      <\/li>      <li>        <a href=\"#i-8\">\u591a\u6b21\u5143\u914d\u5217\u306e\u8981\u7d20\u6570\u3092\u6b63\u78ba\u306b\u628a\u63e1\u3059\u308b<\/a>      <\/li>      <li>        <a href=\"#i-12\">\u914d\u5217\u8981\u7d20\u6570\u306e\u52b9\u7387\u7684\u306a\u64cd\u4f5c\u30c6\u30af\u30cb\u30c3\u30af<\/a>      <\/li>      <li>        <a href=\"#i-16\">\u5927\u898f\u6a21\u30c7\u30fc\u30bf\u51e6\u7406\u306b\u304a\u3051\u308b\u8981\u7d20\u6570\u64cd\u4f5c\u306e\u6700\u9069\u5316<\/a>      <\/li>      <li>        <a href=\"#i-20\">\u5b9f\u8df5\u7684\u306a\u914d\u5217\u8981\u7d20\u6570\u64cd\u4f5c\u306e7\u3064\u306e\u30c6\u30af\u30cb\u30c3\u30af<\/a>      <\/li>      <li>        <a href=\"#i-28\">\u914d\u5217\u8981\u7d20\u6570\u95a2\u9023\u306e\u3088\u304f\u3042\u308b\u8cea\u554f\u3068\u89e3\u6c7a\u6cd5<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-32\">\u307e\u3068\u3081\uff1a\u914d\u5217\u8981\u7d20\u6570\u64cd\u4f5c\u30de\u30b9\u30bf\u30fc\u3078\u306e\u9053<\/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-1\">PHP\u306e\u914d\u5217\u3068\u8981\u7d20\u6570\u306e\u57fa\u790e\u77e5\u8b58<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-2\">PHP\u306b\u304a\u3051\u308b\u914d\u5217\u306e\u6982\u5ff5\u3068\u7a2e\u985e<\/h3>\n\n\n\n<p>PHP\u306e\u914d\u5217\u306f\u975e\u5e38\u306b\u67d4\u8edf\u306a\u30c7\u30fc\u30bf\u69cb\u9020\u3067\u3001\u69d8\u3005\u306a\u7a2e\u985e\u306e\u30c7\u30fc\u30bf\u3092\u4e00\u3064\u306e\u5909\u6570\u306b\u683c\u7d0d\u3067\u304d\u307e\u3059\u3002PHP\u3067\u306f\u4e3b\u306b\u6b21\u306e3\u7a2e\u985e\u306e\u914d\u5217\u304c\u3042\u308a\u307e\u3059\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u914d\u5217<\/strong>: \u6570\u5024\u30ad\u30fc\u3092\u6301\u3064\u914d\u5217<\/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=\"\">$fruits = [\"\u30ea\u30f3\u30b4\", \"\u30d0\u30ca\u30ca\", \"\u30aa\u30ec\u30f3\u30b8\"];<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u9023\u60f3\u914d\u5217<\/strong>: \u6587\u5b57\u5217\u30ad\u30fc\u3092\u6301\u3064\u914d\u5217<\/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=\"\">$person = [\"name\" =&gt; \"\u5c71\u7530\u592a\u90ce\", \"age\" =&gt; 30, \"city\" =&gt; \"\u6771\u4eac\"];<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u591a\u6b21\u5143\u914d\u5217<\/strong>: \u914d\u5217\u306e\u4e2d\u306b\u914d\u5217\u304c\u5165\u308c\u5b50\u306b\u306a\u3063\u305f\u69cb\u9020<\/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=\"\">$users = [\n     [\"name\" =&gt; \"\u5c71\u7530\", \"skills\" =&gt; [\"PHP\", \"JavaScript\"]],\n     [\"name\" =&gt; \"\u4f50\u85e4\", \"skills\" =&gt; [\"Python\", \"Java\", \"C++\"]]\n];<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-3\">\u914d\u5217\u8981\u7d20\u6570\u3092\u7406\u89e3\u3059\u308b\u91cd\u8981\u6027<\/h3>\n\n\n\n<p>\u914d\u5217\u8981\u7d20\u6570\u3092\u6b63\u78ba\u306b\u628a\u63e1\u3059\u308b\u3053\u3068\u306f\u3001\u4ee5\u4e0b\u306e\u7406\u7531\u304b\u3089\u91cd\u8981\u3067\u3059\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30eb\u30fc\u30d7\u51e6\u7406\u306e\u5236\u5fa1<\/strong>: \u914d\u5217\u3092\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3059\u308b\u969b\u306e\u7d42\u4e86\u6761\u4ef6\u306e\u6c7a\u5b9a<\/li>\n\n\n\n<li><strong>\u30e1\u30e2\u30ea\u7ba1\u7406<\/strong>: \u5927\u898f\u6a21\u914d\u5217\u306e\u51e6\u7406\u306b\u304a\u3051\u308b\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u306e\u4e88\u6e2c<\/li>\n\n\n\n<li><strong>\u6761\u4ef6\u5206\u5c90<\/strong>: \u914d\u5217\u306e\u7a7a\u30c1\u30a7\u30c3\u30af\u3084\u8981\u7d20\u6570\u306b\u57fa\u3065\u3044\u305f\u51e6\u7406\u306e\u5206\u5c90<\/li>\n\n\n\n<li><strong>\u30c7\u30d0\u30c3\u30b0<\/strong>: \u4e88\u671f\u305b\u306c\u914d\u5217\u30b5\u30a4\u30ba\u306e\u5909\u5316\u3092\u691c\u51fa<\/li>\n\n\n\n<li><strong>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6700\u9069\u5316<\/strong>: \u51e6\u7406\u524d\u306b\u8981\u7d20\u6570\u3092\u77e5\u308b\u3053\u3068\u3067\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3092\u6700\u9069\u5316<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-4\">\u914d\u5217\u306e\u8981\u7d20\u6570\u3092\u53d6\u5f97\u3059\u308b\u57fa\u672c\u7684\u306a\u65b9\u6cd5<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-5\">count()\u95a2\u6570\u306e\u4f7f\u3044\u65b9\u3068\u8fd4\u308a\u5024<\/h3>\n\n\n\n<p><code>count()<\/code>\u95a2\u6570\u306f\u914d\u5217\u306e\u8981\u7d20\u6570\u3092\u53d6\u5f97\u3059\u308b\u6700\u3082\u57fa\u672c\u7684\u306a\u65b9\u6cd5\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=\"\">$colors = [\"\u8d64\", \"\u9752\", \"\u7dd1\", \"\u9ec4\"];\n$count = count($colors);\necho \"\u914d\u5217\u306e\u8981\u7d20\u6570: \" . $count; \/\/ \u51fa\u529b: \u914d\u5217\u306e\u8981\u7d20\u6570: 4\n<\/pre>\n\n\n\n<p>\u9023\u60f3\u914d\u5217\u3067\u3082\u540c\u69d8\u306b\u4f7f\u7528\u3067\u304d\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$person = [\"name\" =&gt; \"\u5c71\u7530\", \"age\" =&gt; 30, \"city\" =&gt; \"\u6771\u4eac\"];\necho count($person); \/\/ \u51fa\u529b: 3\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-6\">sizeof()\u95a2\u6570\u3068\u306e\u9055\u3044\u3068\u4f7f\u3044\u5206\u3051<\/h3>\n\n\n\n<p><code>sizeof()<\/code>\u95a2\u6570\u306f<code>count()<\/code>\u306e\u30a8\u30a4\u30ea\u30a2\u30b9\uff08\u5225\u540d\uff09\u3067\u3001\u5b8c\u5168\u306b\u540c\u3058\u52d5\u4f5c\u3092\u3057\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$numbers = [1, 2, 3, 4, 5];\necho count($numbers);  \/\/ \u51fa\u529b: 5\necho sizeof($numbers); \/\/ \u51fa\u529b: 5\n<\/pre>\n\n\n\n<p>\u4f7f\u3044\u5206\u3051\u306e\u30dd\u30a4\u30f3\u30c8\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4e00\u822c\u7684\u306b\u306f<code>count()<\/code>\u306e\u65b9\u304c\u5e83\u304f\u4f7f\u308f\u308c\u3066\u3044\u307e\u3059<\/li>\n\n\n\n<li>C\u8a00\u8a9e\u7d4c\u9a13\u8005\u306b\u306f<code>sizeof()<\/code>\u304c\u99b4\u67d3\u307f\u3084\u3059\u3044\u3053\u3068\u3082<\/li>\n\n\n\n<li>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u5185\u3067\u306f\u4e00\u8cab\u6027\u3092\u6301\u305f\u305b\u308b\u305f\u3081\u306b\u3001\u3069\u3061\u3089\u304b\u4e00\u65b9\u306b\u7d71\u4e00\u3059\u308b\u306e\u304c\u826f\u3044\u7fd2\u6163\u3067\u3059<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-7\">\u7a7a\u914d\u5217\u306e\u5224\u5b9a\u65b9\u6cd5\u3068\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/h3>\n\n\n\n<p>\u7a7a\u914d\u5217\u3092\u5224\u5b9a\u3059\u308b\u65b9\u6cd5\u306f\u3044\u304f\u3064\u304b\u3042\u308a\u307e\u3059\u304c\u3001\u305d\u308c\u305e\u308c\u306b\u7279\u5fb4\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=\"\">$emptyArray = [];\n\n\/\/ \u65b9\u6cd51: count()\u3092\u4f7f\u7528\nif (count($emptyArray) === 0) {\n    echo \"\u914d\u5217\u306f\u7a7a\u3067\u3059\";\n}\n\n\/\/ \u65b9\u6cd52: empty()\u3092\u4f7f\u7528\nif (empty($emptyArray)) {\n    echo \"\u914d\u5217\u306f\u7a7a\u3067\u3059\";\n}\n\n\/\/ \u65b9\u6cd53: \u6bd4\u8f03\u6f14\u7b97\u5b50\u3092\u4f7f\u7528\nif ($emptyArray === []) {\n    echo \"\u914d\u5217\u306f\u7a7a\u3067\u3059\";\n}\n<\/pre>\n\n\n\n<p><strong>\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5358\u7d14\u306a\u7a7a\u30c1\u30a7\u30c3\u30af\u306a\u3089<code>empty()<\/code>\u304c\u30b7\u30f3\u30d7\u30eb\u3067\u52b9\u7387\u7684<\/li>\n\n\n\n<li>\u660e\u793a\u7684\u306b\u8981\u7d20\u6570\u304c0\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b\u306a\u3089<code>count($array) === 0<\/code><\/li>\n\n\n\n<li>\u578b\u306e\u53b3\u5bc6\u3055\u304c\u91cd\u8981\u306a\u5834\u5408\u306f<code>$array === []<\/code><\/li>\n\n\n\n<li>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u91cd\u8981\u306a\u5834\u9762\u3067\u306f<code>empty()<\/code>\u304c\u6700\u3082\u9ad8\u901f<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-8\">\u591a\u6b21\u5143\u914d\u5217\u306e\u8981\u7d20\u6570\u3092\u6b63\u78ba\u306b\u628a\u63e1\u3059\u308b<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-9\">\u968e\u5c64\u3054\u3068\u306e\u8981\u7d20\u6570\u30ab\u30a6\u30f3\u30c8\u65b9\u6cd5<\/h3>\n\n\n\n<p>\u591a\u6b21\u5143\u914d\u5217\u306e\u5834\u5408\u3001\u968e\u5c64\u3054\u3068\u306b\u8981\u7d20\u6570\u3092\u30ab\u30a6\u30f3\u30c8\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$teams = [\n    \"\u958b\u767a\" =&gt; [\"\u7530\u4e2d\", \"\u9234\u6728\", \"\u4f50\u85e4\"],\n    \"\u30c7\u30b6\u30a4\u30f3\" =&gt; [\"\u5c71\u672c\", \"\u4f0a\u85e4\"],\n    \"\u55b6\u696d\" =&gt; [\"\u9ad8\u6a4b\", \"\u6e21\u8fba\", \"\u5c0f\u6797\", \"\u52a0\u85e4\"]\n];\n\n\/\/ \u90e8\u7f72\u306e\u6570\u3092\u30ab\u30a6\u30f3\u30c8\n$departments = count($teams); \/\/ 3\n\n\/\/ \u5404\u90e8\u7f72\u306e\u4eba\u6570\u3092\u30ab\u30a6\u30f3\u30c8\n$devCount = count($teams[\"\u958b\u767a\"]); \/\/ 3\n$designCount = count($teams[\"\u30c7\u30b6\u30a4\u30f3\"]); \/\/ 2\n$salesCount = count($teams[\"\u55b6\u696d\"]); \/\/ 4\n\necho \"\u90e8\u7f72\u6570: \" . $departments . \"\\n\";\necho \"\u958b\u767a\u90e8\u306e\u4eba\u6570: \" . $devCount . \"\\n\";\necho \"\u30c7\u30b6\u30a4\u30f3\u90e8\u306e\u4eba\u6570: \" . $designCount . \"\\n\";\necho \"\u55b6\u696d\u90e8\u306e\u4eba\u6570: \" . $salesCount . \"\\n\";\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-10\">count()\u95a2\u6570\u306e\u7b2c\u4e8c\u5f15\u6570RECURSIVE\u306e\u6d3b\u7528\u6cd5<\/h3>\n\n\n\n<p><code>count()<\/code>\u95a2\u6570\u306f\u7b2c\u4e8c\u5f15\u6570\u306b<code>COUNT_RECURSIVE<\/code>\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001\u591a\u6b21\u5143\u914d\u5217\u306e\u3059\u3079\u3066\u306e\u8981\u7d20\u3092\u518d\u5e30\u7684\u306b\u30ab\u30a6\u30f3\u30c8\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=\"\">$nestedArray = [\n    \"a\" =&gt; [1, 2, 3],\n    \"b\" =&gt; [4, 5],\n    \"c\" =&gt; [6, [7, 8, 9]]\n];\n\n\/\/ \u901a\u5e38\u306e\u30ab\u30a6\u30f3\u30c8\uff08\u6700\u4e0a\u4f4d\u30ec\u30d9\u30eb\u306e\u307f\uff09\n$normalCount = count($nestedArray); \/\/ 3\n\n\/\/ \u518d\u5e30\u7684\u306a\u30ab\u30a6\u30f3\u30c8\uff08\u3059\u3079\u3066\u306e\u8981\u7d20\uff09\n$recursiveCount = count($nestedArray, COUNT_RECURSIVE); \/\/ 12\n\necho \"\u901a\u5e38\u30ab\u30a6\u30f3\u30c8: \" . $normalCount . \"\\n\"; \/\/ 3\uff08a, b, c\uff09\necho \"\u518d\u5e30\u30ab\u30a6\u30f3\u30c8: \" . $recursiveCount . \"\\n\"; \/\/ 12\uff08\u3059\u3079\u3066\u306e\u8981\u7d20\uff09\n<\/pre>\n\n\n\n<p><code>COUNT_RECURSIVE<\/code>\u3092\u4f7f\u7528\u3059\u308b\u969b\u306e\u6ce8\u610f\u70b9\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u518d\u5e30\u30ab\u30a6\u30f3\u30c8\u306f\u914d\u5217\u81ea\u4f53\u3082\u542b\u3081\u3066\u30ab\u30a6\u30f3\u30c8\u3059\u308b\u305f\u3081\u3001\u4e88\u60f3\u3088\u308a\u3082\u5024\u304c\u5927\u304d\u304f\u306a\u308b\u3053\u3068\u304c\u3042\u308b<\/li>\n\n\n\n<li>\u975e\u5e38\u306b\u6df1\u3044\u30cd\u30b9\u30c8\u306e\u914d\u5217\u3067\u306f\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u4f4e\u4e0b\u3059\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-11\">\u591a\u6b21\u5143\u914d\u5217\u64cd\u4f5c\u6642\u306e\u6ce8\u610f\u70b9<\/h3>\n\n\n\n<p>\u591a\u6b21\u5143\u914d\u5217\u3092\u6271\u3046\u969b\u306b\u306f\u4ee5\u4e0b\u306e\u70b9\u306b\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u53c2\u7167\u306e\u6271\u3044<\/strong>: \u591a\u6b21\u5143\u914d\u5217\u3092\u30b3\u30d4\u30fc\u3059\u308b\u969b\u306b\u53c2\u7167\u6e21\u3057\u306b\u306a\u308b\u3053\u3068\u304c\u3042\u308b<\/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=\"\">\/\/ \u6d45\u3044\u30b3\u30d4\u30fc\uff08\u53c2\u7167\uff09\u306e\u4f8b\n$original = [\"a\" =&gt; [1, 2, 3]];\n$copy = $original;\n$copy[\"a\"][0] = 99; \/\/ \u5143\u306e\u914d\u5217\u3082\u5909\u66f4\u3055\u308c\u308b\n\n\/\/ \u6df1\u3044\u30b3\u30d4\u30fc\u306b\u306f json_encode\/decode \u3092\u4f7f\u7528\u3059\u308b\u65b9\u6cd5\u3082\n$deepCopy = json_decode(json_encode($original), true);<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u30ad\u30fc\u306e\u5b58\u5728\u78ba\u8a8d<\/strong>: \u591a\u6b21\u5143\u914d\u5217\u306e\u30a2\u30af\u30bb\u30b9\u524d\u306b\u30ad\u30fc\u306e\u5b58\u5728\u78ba\u8a8d\u304c\u91cd\u8981<\/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=\"\">if (isset($users[$userIndex][\"skills\"])) {\n    $skillCount = count($users[$userIndex][\"skills\"]);\n}<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u518d\u5e30\u95a2\u6570\u306e\u6d3b\u7528<\/strong>: \u8907\u96d1\u306a\u591a\u6b21\u5143\u914d\u5217\u306e\u63a2\u7d22\u306b\u306f\u518d\u5e30\u95a2\u6570\u304c\u6709\u52b9<\/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=\"\">function countLeafNodes($array) {\n    $count = 0;\n    foreach ($array as $item) {\n        if (is_array($item)) {\n            $count += countLeafNodes($item);\n        } else {\n            $count++;\n        }\n    }\n    return $count;\n}<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-12\">\u914d\u5217\u8981\u7d20\u6570\u306e\u52b9\u7387\u7684\u306a\u64cd\u4f5c\u30c6\u30af\u30cb\u30c3\u30af<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-13\">\u7279\u5b9a\u6761\u4ef6\u3092\u6e80\u305f\u3059\u8981\u7d20\u3060\u3051\u3092\u30ab\u30a6\u30f3\u30c8\u3059\u308b\u65b9\u6cd5<\/h3>\n\n\n\n<p>\u7279\u5b9a\u306e\u6761\u4ef6\u3092\u6e80\u305f\u3059\u8981\u7d20\u3060\u3051\u3092\u30ab\u30a6\u30f3\u30c8\u3059\u308b\u306b\u306f\u3001\u3044\u304f\u3064\u304b\u306e\u65b9\u6cd5\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=\"\">$numbers = [1, 5, 8, 12, 7, 3, 9, 4];\n\n\/\/ \u65b9\u6cd51: foreach + \u6761\u4ef6\u5224\u5b9a\n$evenCount = 0;\nforeach ($numbers as $number) {\n    if ($number % 2 === 0) {\n        $evenCount++;\n    }\n}\necho \"\u5076\u6570\u306e\u6570: \" . $evenCount . \"\\n\"; \/\/ 3\n\n\/\/ \u65b9\u6cd52: array_filter + count\n$oddNumbers = array_filter($numbers, function($number) {\n    return $number % 2 !== 0;\n});\necho \"\u5947\u6570\u306e\u6570: \" . count($oddNumbers) . \"\\n\"; \/\/ 5\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-14\">array_filter()\u3092\u4f7f\u3063\u305f\u67d4\u8edf\u306a\u8981\u7d20\u6570\u53d6\u5f97<\/h3>\n\n\n\n<p><code>array_filter()<\/code>\u95a2\u6570\u306f\u3001\u914d\u5217\u306e\u8981\u7d20\u3092\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u3059\u308b\u5f37\u529b\u306a\u65b9\u6cd5\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=\"\">$users = [\n    [\"name\" =&gt; \"\u7530\u4e2d\", \"age\" =&gt; 25, \"active\" =&gt; true],\n    [\"name\" =&gt; \"\u9234\u6728\", \"age\" =&gt; 30, \"active\" =&gt; false],\n    [\"name\" =&gt; \"\u4f50\u85e4\", \"age\" =&gt; 22, \"active\" =&gt; true],\n    [\"name\" =&gt; \"\u5c71\u672c\", \"age\" =&gt; 35, \"active\" =&gt; true],\n    [\"name\" =&gt; \"\u4f0a\u85e4\", \"age\" =&gt; 28, \"active\" =&gt; false]\n];\n\n\/\/ \u30a2\u30af\u30c6\u30a3\u30d6\u30e6\u30fc\u30b6\u30fc\u306e\u6570\n$activeUsers = array_filter($users, function($user) {\n    return $user[\"active\"] === true;\n});\necho \"\u30a2\u30af\u30c6\u30a3\u30d6\u30e6\u30fc\u30b6\u30fc\u6570: \" . count($activeUsers) . \"\\n\"; \/\/ 3\n\n\/\/ 30\u6b73\u4ee5\u4e0a\u306e\u30e6\u30fc\u30b6\u30fc\u6570\n$over30 = array_filter($users, function($user) {\n    return $user[\"age\"] &gt;= 30;\n});\necho \"30\u6b73\u4ee5\u4e0a\u306e\u30e6\u30fc\u30b6\u30fc\u6570: \" . count($over30) . \"\\n\"; \/\/ 2\n\n\/\/ PHP 7.4\u4ee5\u964d\u3067\u306f\u30a2\u30ed\u30fc\u95a2\u6570\u3082\u4f7f\u7528\u53ef\u80fd\n$under25 = array_filter($users, fn($user) =&gt; $user[\"age\"] &lt;= 25);\necho \"25\u6b73\u4ee5\u4e0b\u306e\u30e6\u30fc\u30b6\u30fc\u6570: \" . count($under25) . \"\\n\"; \/\/ 2\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-15\">\u9023\u60f3\u914d\u5217\u306e\u30ad\u30fc\u3068\u5024\u306e\u30ab\u30a6\u30f3\u30c8\u6226\u7565<\/h3>\n\n\n\n<p>\u9023\u60f3\u914d\u5217\u306e\u5834\u5408\u3001\u30ad\u30fc\u3068\u5024\u306b\u5bfe\u3057\u3066\u7570\u306a\u308b\u30ab\u30a6\u30f3\u30c8\u6226\u7565\u304c\u5fc5\u8981\u306a\u5834\u5408\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=\"\">$stock = [\n    \"apple\" =&gt; 25,\n    \"banana\" =&gt; 10,\n    \"orange\" =&gt; 15,\n    \"grape\" =&gt; 8,\n    \"melon\" =&gt; 5\n];\n\n\/\/ \u30ad\u30fc\u306e\u6570\uff08\u5546\u54c1\u7a2e\u985e\uff09\u3092\u30ab\u30a6\u30f3\u30c8\n$productTypes = count($stock); \/\/ 5\n\n\/\/ \u7279\u5b9a\u306e\u5024\u306e\u6761\u4ef6\uff08\u5728\u5eab\u304c10\u500b\u4ee5\u4e0b\u306e\u5546\u54c1\uff09\n$lowStock = array_filter($stock, function($quantity) {\n    return $quantity &lt;= 10;\n});\necho \"\u5728\u5eab\u304c\u5c11\u306a\u3044\u5546\u54c1\u6570: \" . count($lowStock) . \"\\n\"; \/\/ 3\n\n\/\/ \u5024\u306e\u5408\u8a08\uff08\u7dcf\u5728\u5eab\u6570\uff09\n$totalStock = array_sum($stock); \/\/ 63\necho \"\u7dcf\u5728\u5eab\u6570: \" . $totalStock . \"\\n\";\n\n\/\/ \u30ad\u30fc\u3092\u53d6\u5f97\u3057\u3066\u30ab\u30a6\u30f3\u30c8\n$fruitNames = array_keys($stock);\necho \"\u5546\u54c1\u540d\u4e00\u89a7: \" . implode(\", \", $fruitNames) . \"\\n\";\n\n\/\/ \u5024\u3092\u53d6\u5f97\u3057\u3066\u30ab\u30a6\u30f3\u30c8\n$quantities = array_values($stock);\necho \"\u5728\u5eab\u6570\u4e00\u89a7: \" . implode(\", \", $quantities) . \"\\n\";\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-16\">\u5927\u898f\u6a21\u30c7\u30fc\u30bf\u51e6\u7406\u306b\u304a\u3051\u308b\u8981\u7d20\u6570\u64cd\u4f5c\u306e\u6700\u9069\u5316<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-17\">\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf\u3092\u6291\u3048\u305f\u52b9\u7387\u7684\u306a\u30ab\u30a6\u30f3\u30c8\u65b9\u6cd5<\/h3>\n\n\n\n<p>\u5927\u898f\u6a21\u30c7\u30fc\u30bf\u3092\u6271\u3046\u5834\u5408\u3001\u30e1\u30e2\u30ea\u52b9\u7387\u3092\u8003\u616e\u3057\u305f\u30ab\u30a6\u30f3\u30c8\u65b9\u6cd5\u304c\u91cd\u8981\u3067\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u975e\u52b9\u7387\u306a\u65b9\u6cd5\uff08\u30e1\u30e2\u30ea\u3092\u5927\u91cf\u6d88\u8cbb\uff09\nfunction countLargeArrayInefficient($filename) {\n    $data = file($filename); \/\/ \u5168\u884c\u3092\u30e1\u30e2\u30ea\u306b\u8aad\u307f\u8fbc\u3080\n    return count($data);\n}\n\n\/\/ \u52b9\u7387\u7684\u306a\u65b9\u6cd5\uff08\u5c11\u306a\u3044\u30e1\u30e2\u30ea\u3067\u5b9f\u884c\uff09\nfunction countLargeArrayEfficient($filename) {\n    $count = 0;\n    $handle = fopen($filename, \"r\");\n    while (!feof($handle)) {\n        $line = fgets($handle);\n        if ($line !== false) {\n            $count++;\n        }\n    }\n    fclose($handle);\n    return $count;\n}\n<\/pre>\n\n\n\n<p>\u307e\u305f\u3001\u5927\u304d\u306a\u914d\u5217\u306e\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u3067\u3082\u52b9\u7387\u5316\u304c\u53ef\u80fd\u3067\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u3092\u4f7f\u7528\u3057\u305f\u7701\u30e1\u30e2\u30ea\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\nfunction filterLargeArray($filename, $condition) {\n    $handle = fopen($filename, \"r\");\n    $count = 0;\n    \n    while (!feof($handle)) {\n        $line = fgets($handle);\n        if ($line !== false &amp;&amp; $condition($line)) {\n            $count++;\n        }\n    }\n    \n    fclose($handle);\n    return $count;\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$countOfLongLines = filterLargeArray(\"huge_data.txt\", function($line) {\n    return strlen($line) &gt; 100;\n});\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-18\">\u30eb\u30fc\u30d7\u51e6\u7406\u5185\u3067\u306e\u8981\u7d20\u6570\u53c2\u7167\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u6539\u5584<\/h3>\n\n\n\n<p>\u30eb\u30fc\u30d7\u5185\u3067\u914d\u5217\u306e\u8981\u7d20\u6570\u3092\u53c2\u7167\u3059\u308b\u5834\u5408\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306b\u5f71\u97ff\u3092\u4e0e\u3048\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$largeArray = range(1, 10000);\n\n\/\/ \u975e\u52b9\u7387\u306a\u65b9\u6cd5\uff08\u6bce\u56de count() \u3092\u547c\u3073\u51fa\u3059\uff09\n$sum = 0;\nfor ($i = 0; $i &lt; count($largeArray); $i++) {\n    $sum += $largeArray[$i];\n}\n\n\/\/ \u52b9\u7387\u7684\u306a\u65b9\u6cd5\uff08\u30eb\u30fc\u30d7\u5916\u3067 count() \u3092\u4e00\u5ea6\u3060\u3051\u5b9f\u884c\uff09\n$count = count($largeArray);\n$sum = 0;\nfor ($i = 0; $i &lt; $count; $i++) {\n    $sum += $largeArray[$i];\n}\n\n\/\/ \u3055\u3089\u306b\u52b9\u7387\u7684\u306a\u65b9\u6cd5\uff08foreach \u3092\u4f7f\u7528\uff09\n$sum = 0;\nforeach ($largeArray as $value) {\n    $sum += $value;\n}\n\n\/\/ \u6700\u3082\u52b9\u7387\u7684\u306a\u65b9\u6cd5\uff08\u7d44\u307f\u8fbc\u307f\u95a2\u6570\u3092\u4f7f\u7528\uff09\n$sum = array_sum($largeArray);\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-19\">\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u6d3b\u7528\u3057\u305f\u7e70\u308a\u8fd4\u3057\u30ab\u30a6\u30f3\u30c8\u306e\u6700\u9069\u5316<\/h3>\n\n\n\n<p>\u540c\u3058\u914d\u5217\u306e\u8981\u7d20\u6570\u3092\u7e70\u308a\u8fd4\u3057\u53c2\u7167\u3059\u308b\u5834\u5408\u3001\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u51e6\u7406\u3092\u6700\u9069\u5316\u3067\u304d\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class ArrayHandler {\n    private $data;\n    private $countCache = null;\n    \n    public function __construct(array $data) {\n        $this-&gt;data = $data;\n    }\n    \n    public function getData() {\n        return $this-&gt;data;\n    }\n    \n    public function add($item) {\n        $this-&gt;data[] = $item;\n        \/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u7121\u52b9\u5316\n        $this-&gt;countCache = null;\n        return $this;\n    }\n    \n    public function remove($index) {\n        if (isset($this-&gt;data[$index])) {\n            unset($this-&gt;data[$index]);\n            $this-&gt;data = array_values($this-&gt;data); \/\/ \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u8a70\u3081\u308b\n            \/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u7121\u52b9\u5316\n            $this-&gt;countCache = null;\n        }\n        return $this;\n    }\n    \n    public function count() {\n        \/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u304c\u3042\u308c\u3070\u305d\u308c\u3092\u4f7f\u7528\n        if ($this-&gt;countCache !== null) {\n            return $this-&gt;countCache;\n        }\n        \n        \/\/ \u306a\u3051\u308c\u3070\u8a08\u7b97\u3057\u3066\u30ad\u30e3\u30c3\u30b7\u30e5\n        $this-&gt;countCache = count($this-&gt;data);\n        return $this-&gt;countCache;\n    }\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$handler = new ArrayHandler([1, 2, 3, 4, 5]);\necho $handler-&gt;count() . \"\\n\"; \/\/ 5\uff08\u8a08\u7b97\u3055\u308c\u308b\uff09\necho $handler-&gt;count() . \"\\n\"; \/\/ 5\uff08\u30ad\u30e3\u30c3\u30b7\u30e5\u304b\u3089\u8fd4\u3055\u308c\u308b\uff09\n$handler-&gt;add(6);\necho $handler-&gt;count() . \"\\n\"; \/\/ 6\uff08\u518d\u8a08\u7b97\u3055\u308c\u308b\uff09\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-20\">\u5b9f\u8df5\u7684\u306a\u914d\u5217\u8981\u7d20\u6570\u64cd\u4f5c\u306e7\u3064\u306e\u30c6\u30af\u30cb\u30c3\u30af<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-21\">\u30c6\u30af\u30cb\u30c3\u30af1: \u524d\u5f8c\u306e\u8981\u7d20\u6570\u6bd4\u8f03\u306b\u3088\u308b\u5909\u66f4\u691c\u77e5<\/h3>\n\n\n\n<p>\u914d\u5217\u306e\u5909\u66f4\u3092\u691c\u77e5\u3059\u308b\u305f\u3081\u306b\u3001\u51e6\u7406\u524d\u5f8c\u306e\u8981\u7d20\u6570\u3092\u6bd4\u8f03\u3059\u308b\u65b9\u6cd5\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=\"\">function processAndDetectChanges($array, $processFunction) {\n    $beforeCount = count($array);\n    $result = $processFunction($array);\n    $afterCount = count($result);\n    \n    if ($afterCount !== $beforeCount) {\n        echo \"\u914d\u5217\u306e\u8981\u7d20\u6570\u304c\u5909\u5316\u3057\u307e\u3057\u305f: {$beforeCount} -&gt; {$afterCount}\\n\";\n    } else {\n        echo \"\u914d\u5217\u306e\u8981\u7d20\u6570\u306f\u5909\u5316\u3057\u3066\u3044\u307e\u305b\u3093: {$beforeCount}\\n\";\n    }\n    \n    return $result;\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$numbers = [1, 2, 3, 4, 5];\n$doubled = processAndDetectChanges($numbers, function($arr) {\n    return array_map(fn($n) =&gt; $n * 2, $arr);\n}); \/\/ \u51fa\u529b: \u914d\u5217\u306e\u8981\u7d20\u6570\u306f\u5909\u5316\u3057\u3066\u3044\u307e\u305b\u3093: 5\n\n$filtered = processAndDetectChanges($numbers, function($arr) {\n    return array_filter($arr, fn($n) =&gt; $n &gt; 3);\n}); \/\/ \u51fa\u529b: \u914d\u5217\u306e\u8981\u7d20\u6570\u304c\u5909\u5316\u3057\u307e\u3057\u305f: 5 -&gt; 2\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-22\">\u30c6\u30af\u30cb\u30c3\u30af2: \u30a4\u30c6\u30ec\u30fc\u30bf\u3092\u4f7f\u3063\u305f\u5927\u91cf\u8981\u7d20\u306e\u52b9\u7387\u7684\u30ab\u30a6\u30f3\u30c8<\/h3>\n\n\n\n<p>SPL\u30a4\u30c6\u30ec\u30fc\u30bf\u3092\u4f7f\u7528\u3057\u3066\u3001\u5927\u91cf\u306e\u8981\u7d20\u3092\u52b9\u7387\u7684\u306b\u51e6\u7406\u3059\u308b\u65b9\u6cd5\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=\"\">function countWithIterator($directory, $extension) {\n    $count = 0;\n    $iterator = new RecursiveIteratorIterator(\n        new RecursiveDirectoryIterator($directory)\n    );\n    \n    foreach ($iterator as $file) {\n        if ($file-&gt;isFile() &amp;&amp; $file-&gt;getExtension() === $extension) {\n            $count++;\n        }\n    }\n    \n    return $count;\n}\n\n\/\/ \u4f7f\u7528\u4f8b\uff1a\u6307\u5b9a\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306ePHP\u30d5\u30a1\u30a4\u30eb\u6570\u3092\u30ab\u30a6\u30f3\u30c8\n$phpFileCount = countWithIterator('\/var\/www\/project', 'php');\necho \"PHP\u30d5\u30a1\u30a4\u30eb\u306e\u6570: {$phpFileCount}\\n\";\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-23\">\u30c6\u30af\u30cb\u30c3\u30af3: \u914d\u5217\u95a2\u6570\u306e\u9023\u9396\u306b\u3088\u308b\u8981\u7d20\u6570\u64cd\u4f5c<\/h3>\n\n\n\n<p>\u914d\u5217\u95a2\u6570\u3092\u9023\u9396\u3055\u305b\u3066\u3001\u8907\u96d1\u306a\u64cd\u4f5c\u3068\u8981\u7d20\u6570\u30ab\u30a6\u30f3\u30c8\u3092\u52b9\u7387\u7684\u306b\u884c\u3046\u65b9\u6cd5\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=\"\">$users = [\n    [\"name\" =&gt; \"\u7530\u4e2d\", \"age\" =&gt; 25, \"skills\" =&gt; [\"PHP\", \"JavaScript\"]],\n    [\"name\" =&gt; \"\u9234\u6728\", \"age\" =&gt; 30, \"skills\" =&gt; [\"Python\", \"Java\"]],\n    [\"name\" =&gt; \"\u4f50\u85e4\", \"age\" =&gt; 22, \"skills\" =&gt; [\"PHP\", \"CSS\", \"HTML\"]],\n    [\"name\" =&gt; \"\u5c71\u672c\", \"age\" =&gt; 35, \"skills\" =&gt; [\"PHP\", \"Go\", \"Rust\"]]\n];\n\n\/\/ PHP\u30b9\u30ad\u30eb\u3092\u6301\u306430\u6b73\u672a\u6e80\u306e\u30e6\u30fc\u30b6\u30fc\u6570\u3092\u53d6\u5f97\n$phpYoungUsers = count(array_filter($users, function($user) {\n    return $user[\"age\"] &lt; 30 &amp;&amp; in_array(\"PHP\", $user[\"skills\"]);\n}));\n\necho \"PHP\u30b9\u30ad\u30eb\u3092\u6301\u306430\u6b73\u672a\u6e80\u306e\u30e6\u30fc\u30b6\u30fc\u6570: {$phpYoungUsers}\\n\"; \/\/ 2\n\n\/\/ \u5404\u30e6\u30fc\u30b6\u30fc\u306e\u30b9\u30ad\u30eb\u6570\u306e\u5408\u8a08\u3092\u53d6\u5f97\n$totalSkills = array_sum(array_map(function($user) {\n    return count($user[\"skills\"]);\n}, $users));\n\necho \"\u5168\u30e6\u30fc\u30b6\u30fc\u306e\u30b9\u30ad\u30eb\u6570\u5408\u8a08: {$totalSkills}\\n\"; \/\/ 11\n\n\/\/ \u30b9\u30ad\u30eb\u6570\u304c\u6700\u3082\u591a\u3044\u30e6\u30fc\u30b6\u30fc\u3092\u53d6\u5f97\n$userWithMostSkills = array_reduce($users, function($carry, $user) {\n    return !$carry || count($user[\"skills\"]) &gt; count($carry[\"skills\"]) ? $user : $carry;\n}, null);\n\necho \"\u6700\u3082\u30b9\u30ad\u30eb\u304c\u591a\u3044\u30e6\u30fc\u30b6\u30fc: {$userWithMostSkills[\"name\"]} ({$userWithMostSkills[\"age\"]}\u6b73)\\n\";\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-24\">\u30c6\u30af\u30cb\u30c3\u30af4: \u8981\u7d20\u6570\u3092\u4fdd\u6301\u3059\u308b\u72ec\u81ea\u30af\u30e9\u30b9\u306e\u5b9f\u88c5<\/h3>\n\n\n\n<p>\u914d\u5217\u64cd\u4f5c\u3068\u8981\u7d20\u6570\u7ba1\u7406\u3092\u4e00\u5143\u5316\u3057\u305f\u72ec\u81ea\u30af\u30e9\u30b9\u3092\u5b9f\u88c5\u3059\u308b\u65b9\u6cd5\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=\"\">class SmartArray implements Countable {\n    private $items = [];\n    private $modificationCount = 0;\n    \n    public function add($item) {\n        $this-&gt;items[] = $item;\n        $this-&gt;modificationCount++;\n        return $this;\n    }\n    \n    public function remove($index) {\n        if (isset($this-&gt;items[$index])) {\n            unset($this-&gt;items[$index]);\n            $this-&gt;items = array_values($this-&gt;items);\n            $this-&gt;modificationCount++;\n        }\n        return $this;\n    }\n    \n    public function filter(callable $callback) {\n        $filtered = array_filter($this-&gt;items, $callback);\n        if (count($filtered) !== count($this-&gt;items)) {\n            $this-&gt;items = array_values($filtered);\n            $this-&gt;modificationCount++;\n        }\n        return $this;\n    }\n    \n    public function count() {\n        return count($this-&gt;items);\n    }\n    \n    public function getModificationCount() {\n        return $this-&gt;modificationCount;\n    }\n    \n    public function getAll() {\n        return $this-&gt;items;\n    }\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$smartArray = new SmartArray();\n$smartArray-&gt;add(\"apple\")-&gt;add(\"banana\")-&gt;add(\"orange\");\necho \"\u8981\u7d20\u6570: \" . count($smartArray) . \"\\n\"; \/\/ 3\necho \"\u5909\u66f4\u56de\u6570: \" . $smartArray-&gt;getModificationCount() . \"\\n\"; \/\/ 3\n\n$smartArray-&gt;filter(function($item) {\n    return strlen($item) &gt; 5;\n});\necho \"\u30d5\u30a3\u30eb\u30bf\u30fc\u5f8c\u306e\u8981\u7d20\u6570: \" . count($smartArray) . \"\\n\"; \/\/ 2\necho \"\u5909\u66f4\u56de\u6570: \" . $smartArray-&gt;getModificationCount() . \"\\n\"; \/\/ 4\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-25\">\u30c6\u30af\u30cb\u30c3\u30af5: SPLFixedArray\u3092\u4f7f\u3063\u305f\u56fa\u5b9a\u9577\u914d\u5217\u306e\u6d3b\u7528<\/h3>\n\n\n\n<p><code>SplFixedArray<\/code>\u3092\u4f7f\u7528\u3057\u3066\u3001\u30b5\u30a4\u30ba\u304c\u56fa\u5b9a\u3055\u308c\u305f\u52b9\u7387\u7684\u306a\u914d\u5217\u3092\u6271\u3046\u65b9\u6cd5\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=\"\">\/\/ \u901a\u5e38\u306e\u914d\u5217\n$normalArray = [];\nfor ($i = 0; $i &lt; 100000; $i++) {\n    $normalArray[] = $i;\n}\n$normalMemory = memory_get_usage();\n\n\/\/ \u30b5\u30a4\u30ba\u56fa\u5b9a\u306e\u914d\u5217\n$fixedArray = new SplFixedArray(100000);\nfor ($i = 0; $i &lt; 100000; $i++) {\n    $fixedArray[$i] = $i;\n}\n$fixedMemory = memory_get_usage();\n\necho \"\u901a\u5e38\u914d\u5217\u306e\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf: \" . ($normalMemory \/ 1024 \/ 1024) . \" MB\\n\";\necho \"\u56fa\u5b9a\u914d\u5217\u306e\u30e1\u30e2\u30ea\u4f7f\u7528\u91cf: \" . ($fixedMemory \/ 1024 \/ 1024) . \" MB\\n\";\necho \"\u8981\u7d20\u6570: \" . count($fixedArray) . \"\\n\"; \/\/ 100000\n\n\/\/ \u30b5\u30a4\u30ba\u5909\u66f4\n$fixedArray-&gt;setSize(50000);\necho \"\u30b5\u30a4\u30ba\u5909\u66f4\u5f8c\u306e\u8981\u7d20\u6570: \" . count($fixedArray) . \"\\n\"; \/\/ 50000\n\n\/\/ \u901a\u5e38\u914d\u5217\u3068\u306e\u5909\u63db\n$normalFromFixed = $fixedArray-&gt;toArray();\n$fixedFromNormal = SplFixedArray::fromArray($normalArray);\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-26\">\u30c6\u30af\u30cb\u30c3\u30af6: Generator\u3092\u4f7f\u3063\u305f\u5927\u91cf\u30c7\u30fc\u30bf\u306e\u8981\u7d20\u6570\u7ba1\u7406<\/h3>\n\n\n\n<p>\u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u3092\u4f7f\u7528\u3057\u3066\u5927\u91cf\u30c7\u30fc\u30bf\u3092\u52b9\u7387\u7684\u306b\u51e6\u7406\u3057\u3001\u30ab\u30a6\u30f3\u30c8\u3059\u308b\u65b9\u6cd5\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=\"\">function generateLargeDataset($size) {\n    for ($i = 0; $i &lt; $size; $i++) {\n        yield $i =&gt; \"\u9805\u76ee\" . $i;\n    }\n}\n\n\/\/ \u30e1\u30e2\u30ea\u52b9\u7387\u306e\u826f\u3044\u30ab\u30a6\u30f3\u30c8\u65b9\u6cd5\nfunction countGenerator($generator) {\n    $count = 0;\n    foreach ($generator as $item) {\n        $count++;\n    }\n    return $count;\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$largeDataGenerator = generateLargeDataset(1000000);\n$startTime = microtime(true);\n$count = countGenerator($largeDataGenerator);\n$endTime = microtime(true);\n\necho \"\u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u306e\u8981\u7d20\u6570: {$count}\\n\";\necho \"\u51e6\u7406\u6642\u9593: \" . ($endTime - $startTime) . \" \u79d2\\n\";\n\n\/\/ \u6ce8\u610f: \u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u306f\u30a4\u30c6\u30ec\u30fc\u30bf\u3068\u3057\u3066\u4e00\u5ea6\u3057\u304b\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093\n\/\/ \u518d\u5ea6\u30ab\u30a6\u30f3\u30c8\u3059\u308b\u306b\u306f\u65b0\u3057\u3044\u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u3092\u4f5c\u6210\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\n$newGenerator = generateLargeDataset(1000000);\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-27\">\u30c6\u30af\u30cb\u30c3\u30af7: \u914d\u5217\u8981\u7d20\u6570\u306e\u4e26\u5217\u51e6\u7406\u306b\u3088\u308b\u9ad8\u901f\u5316<\/h3>\n\n\n\n<p>\u5927\u898f\u6a21\u914d\u5217\u3092\u5206\u5272\u3057\u3066\u4e26\u5217\u51e6\u7406\u3057\u3001\u7d50\u679c\u3092\u96c6\u7d04\u3059\u308b\u65b9\u6cd5\u3067\u3059\uff08PHP 7.4\u4ee5\u4e0a\uff09\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=\"\">\/\/ \u914d\u5217\u3092\u5206\u5272\u3057\u3066\u51e6\u7406\u3059\u308b\u95a2\u6570\nfunction processArrayChunks($array, $callback, $chunkSize = 1000) {\n    $chunks = array_chunk($array, $chunkSize);\n    $results = [];\n    \n    foreach ($chunks as $chunk) {\n        \/\/ \u5b9f\u969b\u306e\u4e26\u5217\u51e6\u7406\u306fpcntl_fork\u306a\u3069\u3092\u4f7f\u7528\u3059\u308b\u304b\u3001\n        \/\/ ReactPHP\u3084Amphp\u306e\u3088\u3046\u306a\u975e\u540c\u671f\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u7528\u3057\u307e\u3059\n        \/\/ \u3053\u3053\u3067\u306f\u7c21\u7565\u5316\u306e\u305f\u3081\u3001\u9010\u6b21\u51e6\u7406\u3067\u793a\u3057\u307e\u3059\n        $results[] = $callback($chunk);\n    }\n    \n    return array_sum($results);\n}\n\n\/\/ \u4f7f\u7528\u4f8b\uff1a\u5927\u91cf\u306e\u6570\u5024\u914d\u5217\u304b\u3089\u7279\u5b9a\u6761\u4ef6\u306e\u8981\u7d20\u6570\u3092\u30ab\u30a6\u30f3\u30c8\n$largeNumbers = range(1, 1000000);\n$startTime = microtime(true);\n\n$evenCount = processArrayChunks($largeNumbers, function($chunk) {\n    return count(array_filter($chunk, fn($n) =&gt; $n % 2 === 0));\n});\n\n$endTime = microtime(true);\necho \"\u5076\u6570\u306e\u6570: {$evenCount}\\n\"; \/\/ 500000\necho \"\u51e6\u7406\u6642\u9593: \" . ($endTime - $startTime) . \" \u79d2\\n\";\n<\/pre>\n\n\n\n<p>\u5b9f\u969b\u306e\u4e26\u5217\u51e6\u7406\u306b\u306f\u3001PHP-FPM\u306e\u30ef\u30fc\u30ab\u30fc\u30d7\u30ed\u30bb\u30b9\u3084\u3001ReactPHP\u3001Amphp\u3001Guzzle Promises\u3001Swoole\u306a\u3069\u306e\u975e\u540c\u671f\/\u4e26\u5217\u51e6\u7406\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3092\u304a\u52e7\u3081\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-28\">\u914d\u5217\u8981\u7d20\u6570\u95a2\u9023\u306e\u3088\u304f\u3042\u308b\u8cea\u554f\u3068\u89e3\u6c7a\u6cd5<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-29\">\u300cWarning: count(): Parameter must be an array or\u2026\u300d\u30a8\u30e9\u30fc\u306e\u5bfe\u51e6\u6cd5<\/h3>\n\n\n\n<p>\u3053\u306e\u30a8\u30e9\u30fc\u306f\u3001\u914d\u5217\u3067\u306a\u3044\u3082\u306e\u306b\u5bfe\u3057\u3066<code>count()<\/code>\u3092\u4f7f\u7528\u3057\u305f\u5834\u5408\u306b\u767a\u751f\u3057\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30a8\u30e9\u30fc\u304c\u767a\u751f\u3059\u308b\u30b1\u30fc\u30b9\n$notAnArray = null;\n$count = count($notAnArray); \/\/ Warning: count(): Parameter must be an array or...\n\n\/\/ \u5bfe\u51e6\u6cd51: is_array\u3067\u78ba\u8a8d\nif (is_array($notAnArray)) {\n    $count = count($notAnArray);\n} else {\n    $count = 0;\n}\n\n\/\/ \u5bfe\u51e6\u6cd52: \u4e09\u9805\u6f14\u7b97\u5b50\u3092\u4f7f\u7528\n$count = is_array($notAnArray) ? count($notAnArray) : 0;\n\n\/\/ \u5bfe\u51e6\u6cd53: \u30ad\u30e3\u30b9\u30c8\u6f14\u7b97\u5b50\u3092\u4f7f\u7528\uff08PHP 7.2\u4ee5\u964d\u3067\u6709\u52b9\uff09\n$count = count((array) $notAnArray);\n\n\/\/ \u5bfe\u51e6\u6cd54: \u30ab\u30b9\u30bf\u30e0\u95a2\u6570\u3092\u4f5c\u6210\nfunction safeCount($var) {\n    return is_countable($var) ? count($var) : 0;\n}\n$count = safeCount($notAnArray);\n<\/pre>\n\n\n\n<p>PHP 7.3\u4ee5\u964d\u3067\u306f\u3001<code>is_countable()<\/code>\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3084\u30ea\u30bd\u30fc\u30b9\u304c<code>count()<\/code>\u53ef\u80fd\u304b\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-30\">\u914d\u5217\u8981\u7d20\u6570\u306e\u5909\u5316\u3092\u76e3\u8996\u3059\u308b\u65b9\u6cd5<\/h3>\n\n\n\n<p>\u914d\u5217\u8981\u7d20\u6570\u306e\u5909\u5316\u3092\u76e3\u8996\u3059\u308b\u305f\u3081\u306e\u3044\u304f\u3064\u304b\u306e\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">class ArrayWatcher {\n    private $array;\n    private $lastCount;\n    private $callbacks = [];\n    \n    public function __construct(array &amp;$array) {\n        $this-&gt;array = &amp;$array;\n        $this-&gt;lastCount = count($array);\n    }\n    \n    public function onChange(callable $callback) {\n        $this-&gt;callbacks[] = $callback;\n        return $this;\n    }\n    \n    public function check() {\n        $currentCount = count($this-&gt;array);\n        \n        if ($currentCount !== $this-&gt;lastCount) {\n            $oldCount = $this-&gt;lastCount;\n            $this-&gt;lastCount = $currentCount;\n            \n            foreach ($this-&gt;callbacks as $callback) {\n                call_user_func($callback, $this-&gt;array, $oldCount, $currentCount);\n            }\n        }\n        \n        return $this;\n    }\n}\n\n\/\/ \u4f7f\u7528\u4f8b\n$items = [\"apple\", \"banana\", \"orange\"];\n$watcher = new ArrayWatcher($items);\n\n$watcher-&gt;onChange(function($array, $oldCount, $newCount) {\n    echo \"\u914d\u5217\u306e\u8981\u7d20\u6570\u304c\u5909\u5316\u3057\u307e\u3057\u305f: {$oldCount} -&gt; {$newCount}\\n\";\n    echo \"\u73fe\u5728\u306e\u8981\u7d20: \" . implode(\", \", $array) . \"\\n\";\n});\n\n$items[] = \"grape\";\n$watcher-&gt;check(); \/\/ \u51fa\u529b: \u914d\u5217\u306e\u8981\u7d20\u6570\u304c\u5909\u5316\u3057\u307e\u3057\u305f: 3 -&gt; 4 ...\n\n\/\/ \u8907\u6570\u306e\u8981\u7d20\u3092\u8ffd\u52a0\n$items = array_merge($items, [\"melon\", \"kiwi\"]);\n$watcher-&gt;check(); \/\/ \u51fa\u529b: \u914d\u5217\u306e\u8981\u7d20\u6570\u304c\u5909\u5316\u3057\u307e\u3057\u305f: 4 -&gt; 6 ...\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-31\">PHP8\u3067\u306e\u914d\u5217\u95a2\u6570\u306e\u5909\u66f4\u70b9\u3068\u8981\u7d20\u6570\u64cd\u4f5c\u3078\u306e\u5f71\u97ff<\/h3>\n\n\n\n<p>PHP8\u3067\u5c0e\u5165\u3055\u308c\u305f\u914d\u5217\u95a2\u6570\u306e\u5909\u66f4\u70b9\u3068\u3001\u8981\u7d20\u6570\u64cd\u4f5c\u3078\u306e\u5f71\u97ff\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>count()\u306e\u6539\u5584<\/strong>: PHP8\u3067\u306f\u3001countable\u5b9f\u88c5\u306e\u691c\u8a3c\u304c\u5f37\u5316\u3055\u308c\u3001\u3088\u308a\u53b3\u5bc6\u306a\u30a8\u30e9\u30fc\u30c1\u30a7\u30c3\u30af\u304c\u884c\u308f\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u914d\u5217\u30b9\u30d7\u30ec\u30c3\u30c9\u6f14\u7b97\u5b50\u306e\u5f37\u5316<\/strong>: PHP8\u3067\u306f\u3001\u30b9\u30d7\u30ec\u30c3\u30c9\u6f14\u7b97\u5b50\uff08<code>...<\/code>\uff09\u3092\u4f7f\u7528\u3057\u3066\u3001\u3088\u308a\u30b7\u30f3\u30d7\u30eb\u306b\u914d\u5217\u3092\u7d50\u5408\u3067\u304d\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ PHP 7.4\u4ee5\u524d\n$array1 = [1, 2, 3];\n$array2 = [4, 5, 6]; $combined = array_merge($array1, $array2);\n\n\/\/ PHP 8\u4ee5\u964d\n$combined = [...$array1, ...$array2];\n\necho count($combined); \/\/ 6<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u30cd\u30b9\u30c8\u3055\u308c\u305f\u914d\u5217\u306e\u30c7\u30b9\u30c8\u30e9\u30af\u30c1\u30e3\u30ea\u30f3\u30b0<\/strong>: PHP8\u3067\u306f\u3001\u30cd\u30b9\u30c8\u3055\u308c\u305f\u914d\u5217\u306e\u8981\u7d20\u30a2\u30af\u30bb\u30b9\u304c\u7c21\u7565\u5316\u3055\u308c\u307e\u3057\u305f\u3002 <\/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=\"\">$data = [\n    \"user\" =&gt; [\n        \"name\" =&gt; \"\u5c71\u7530\",\n        \"details\" =&gt; [\"age\" =&gt; 30, \"city\" =&gt; \"\u6771\u4eac\"]\n    ]\n];\n\n\/\/ PHP 8\u4ee5\u964d\n[\"user\" =&gt; [\"name\" =&gt; $name, \"details\" =&gt; [\"age\" =&gt; $age]]] = $data; echo \"$name ($age)\"; \/\/ \u5c71\u7530 (30)<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u95a2\u6570\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u540d\u524d\u4ed8\u304d\u5f15\u6570<\/strong>: PHP8\u3067\u5c0e\u5165\u3055\u308c\u305f\u540d\u524d\u4ed8\u304d\u5f15\u6570\u3092\u4f7f\u7528\u3057\u3066\u3001\u914d\u5217\u95a2\u6570\u306e\u5f15\u6570\u3092\u3088\u308a\u660e\u78ba\u306b\u6307\u5b9a\u3067\u304d\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ PHP 7.4\u4ee5\u524d\n$count = count($array, COUNT_RECURSIVE);\n\n\/\/ PHP 8\u4ee5\u964d\n$count = count(array: $array, mode: COUNT_RECURSIVE);<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>match\u5f0f<\/strong>: PHP8\u306ematch\u5f0f\u3092\u4f7f\u7528\u3057\u3066\u3001\u3088\u308a\u7c21\u6f54\u306b\u914d\u5217\u30b5\u30a4\u30ba\u306b\u57fa\u3065\u304f\u5206\u5c90\u3092\u8a18\u8ff0\u3067\u304d\u307e\u3059\u3002<\/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=\"\">$array = [1, 2, 3];\n\n\/\/ PHP 7.4\u4ee5\u524d\nswitch (count($array)) {\n    case 0:\n        $message = \"\u914d\u5217\u306f\u7a7a\u3067\u3059\";\n        break;\n    case 1:\n        $message = \"\u914d\u5217\u306b\u306f1\u3064\u306e\u8981\u7d20\u304c\u3042\u308a\u307e\u3059\";\n        break;\n    default:\n        $message = \"\u914d\u5217\u306b\u306f\u8907\u6570\u306e\u8981\u7d20\u304c\u3042\u308a\u307e\u3059\";\n        break;\n}\n\n\/\/ PHP 8\u4ee5\u964d\n$message = match(count($array)) {\n    0 =&gt; \"\u914d\u5217\u306f\u7a7a\u3067\u3059\",\n    1 =&gt; \"\u914d\u5217\u306b\u306f1\u3064\u306e\u8981\u7d20\u304c\u3042\u308a\u307e\u3059\",\n    default =&gt; \"\u914d\u5217\u306b\u306f\u8907\u6570\u306e\u8981\u7d20\u304c\u3042\u308a\u307e\u3059\"\n};\n\necho $message; \/\/ \u914d\u5217\u306b\u306f\u8907\u6570\u306e\u8981\u7d20\u304c\u3042\u308a\u307e\u3059<\/pre>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u5909\u66f4\u306b\u3088\u308a\u3001PHP8\u3067\u306f\u914d\u5217\u64cd\u4f5c\u3068\u305d\u306e\u8981\u7d20\u6570\u7ba1\u7406\u304c\u3088\u308a\u7c21\u6f54\u304b\u3064\u52b9\u7387\u7684\u306b\u884c\u3048\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-32\">\u307e\u3068\u3081\uff1a\u914d\u5217\u8981\u7d20\u6570\u64cd\u4f5c\u30de\u30b9\u30bf\u30fc\u3078\u306e\u9053<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-33\">\u5b9f\u52d9\u3067\u5373\u6d3b\u7528\u3067\u304d\u308b\u914d\u5217\u8981\u7d20\u6570\u30c6\u30af\u30cb\u30c3\u30af\u306e\u30dd\u30a4\u30f3\u30c8<\/h3>\n\n\n\n<p>PHP\u306e\u914d\u5217\u8981\u7d20\u6570\u64cd\u4f5c\u3092\u30de\u30b9\u30bf\u30fc\u3059\u308b\u305f\u3081\u306b\u3001\u4ee5\u4e0b\u306e\u30dd\u30a4\u30f3\u30c8\u3092\u62bc\u3055\u3048\u3066\u304a\u304d\u307e\u3057\u3087\u3046\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u57fa\u672c\u306b\u5fe0\u5b9f\u306b<\/strong>: <code>count()<\/code>\u3084<code>empty()<\/code>\u306a\u3069\u306e\u57fa\u672c\u95a2\u6570\u306e\u7279\u6027\u3092\u7406\u89e3\u3059\u308b\u3053\u3068\u304c\u3001\u52b9\u7387\u7684\u306a\u914d\u5217\u64cd\u4f5c\u306e\u7b2c\u4e00\u6b69\u3067\u3059\u3002<\/li>\n\n\n\n<li><strong>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u610f\u8b58<\/strong>: \u5927\u898f\u6a21\u306a\u914d\u5217\u3084\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3067\u306f\u3001\u8981\u7d20\u6570\u306e\u53d6\u5f97\u65b9\u6cd5\u3068\u30bf\u30a4\u30df\u30f3\u30b0\u304c\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306b\u5927\u304d\u304f\u5f71\u97ff\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u9069\u5207\u306a\u30c4\u30fc\u30eb\u3092\u9078\u629e<\/strong>: \u76ee\u7684\u306b\u5fdc\u3058\u3066\u9069\u5207\u306a\u914d\u5217\u95a2\u6570\u3084SPL\u30af\u30e9\u30b9\u3092\u9078\u629e\u3059\u308b\u3053\u3068\u3067\u3001\u30b3\u30fc\u30c9\u306e\u53ef\u8aad\u6027\u3068\u52b9\u7387\u3092\u5411\u4e0a\u3055\u305b\u3089\u308c\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u591a\u6b21\u5143\u914d\u5217\u3092\u5236\u3059\u308b<\/strong>: \u591a\u6b21\u5143\u914d\u5217\u306e\u8981\u7d20\u6570\u7ba1\u7406\u3092\u30de\u30b9\u30bf\u30fc\u3059\u308b\u3053\u3068\u3067\u3001\u8907\u96d1\u306a\u30c7\u30fc\u30bf\u69cb\u9020\u3082\u52b9\u7387\u7684\u306b\u6271\u3048\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u30a8\u30e9\u30fc\u51e6\u7406\u3092\u5fd8\u308c\u305a\u306b<\/strong>: \u8981\u7d20\u6570\u53d6\u5f97\u6642\u306e\u578b\u30c1\u30a7\u30c3\u30af\u3084\u30a8\u30e9\u30fc\u51e6\u7406\u3092\u9069\u5207\u306b\u884c\u3046\u3053\u3068\u3067\u3001\u5805\u7262\u306a\u30b3\u30fc\u30c9\u3092\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u6d3b\u7528<\/strong>: \u8981\u7d20\u6570\u306e\u8a08\u7b97\u7d50\u679c\u3092\u30ad\u30e3\u30c3\u30b7\u30e5\u3059\u308b\u3053\u3068\u3067\u3001\u7e70\u308a\u8fd4\u3057\u53c2\u7167\u3059\u308b\u5834\u5408\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u5411\u4e0a\u3067\u304d\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u6700\u65b0\u306e\u6a5f\u80fd\u3092\u6d3b\u7528<\/strong>: PHP7\u4ee5\u964d\u3067\u5c0e\u5165\u3055\u308c\u305f\u65b0\u6a5f\u80fd\u3084\u6539\u5584\u70b9\u3092\u7a4d\u6975\u7684\u306b\u6d3b\u7528\u3057\u3001\u3088\u308a\u7c21\u6f54\u3067\u52b9\u7387\u7684\u306a\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u307e\u3057\u3087\u3046\u3002<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-34\">\u3055\u3089\u306a\u308b\u914d\u5217\u64cd\u4f5c\u30b9\u30ad\u30eb\u3092\u9ad8\u3081\u308b\u305f\u3081\u306e\u5b66\u7fd2\u30ea\u30bd\u30fc\u30b9<\/h3>\n\n\n\n<p>PHP\u306e\u914d\u5217\u64cd\u4f5c\u30b9\u30ad\u30eb\u3092\u3055\u3089\u306b\u9ad8\u3081\u308b\u305f\u3081\u306e\u30ea\u30bd\u30fc\u30b9\u3092\u7d39\u4ecb\u3057\u307e\u3059\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>PHP\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/strong>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.php.net\/manual\/ja\/ref.array.php\">\u914d\u5217\u95a2\u6570<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.php.net\/manual\/ja\/book.spl.php\">SPL\uff08Standard PHP Library\uff09<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u304a\u3059\u3059\u3081\u306e\u66f8\u7c4d<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u300ePHP7 \u5b9f\u8df5\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u300f<\/li>\n\n\n\n<li>\u300eModern PHP\u300f\uff08Josh Lockhart\u8457\uff09<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u30aa\u30f3\u30e9\u30a4\u30f3\u30b3\u30fc\u30b9\u30fb\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb<\/strong>\n<ul class=\"wp-block-list\">\n<li>Laracasts: Modern PHP Learning<\/li>\n\n\n\n<li>Udemy: \u4e0a\u7d1a\u8005\u5411\u3051PHP\u914d\u5217\u64cd\u4f5c\u30de\u30b9\u30bf\u30fc\u30b3\u30fc\u30b9<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u30b3\u30df\u30e5\u30cb\u30c6\u30a3\u30ea\u30bd\u30fc\u30b9<\/strong>\n<ul class=\"wp-block-list\">\n<li>PHP\u30e6\u30fc\u30b6\u30fc\u30b0\u30eb\u30fc\u30d7\uff08PHP-UG\uff09\u306e\u52c9\u5f37\u4f1a<\/li>\n\n\n\n<li>PHP\u95a2\u9023\u306e\u30ab\u30f3\u30d5\u30a1\u30ec\u30f3\u30b9\u3084\u30bb\u30df\u30ca\u30fc<\/li>\n\n\n\n<li>GitHub\u4e0a\u306e\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u30d7\u30ed\u30b8\u30a7\u30af\u30c8<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u7df4\u7fd2\u30b5\u30a4\u30c8<\/strong>\n<ul class=\"wp-block-list\">\n<li>HackerRank<\/li>\n\n\n\n<li>LeetCode<\/li>\n\n\n\n<li>CodeWars<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u30ea\u30bd\u30fc\u30b9\u3092\u6d3b\u7528\u3057\u3066\u3001PHP\u306e\u914d\u5217\u64cd\u4f5c\u30b9\u30ad\u30eb\u3092\u7d99\u7d9a\u7684\u306b\u9ad8\u3081\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002\u914d\u5217\u8981\u7d20\u6570\u306e\u9069\u5207\u306a\u7ba1\u7406\u3068\u64cd\u4f5c\u306f\u3001\u52b9\u7387\u7684\u306a\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u57fa\u76e4\u3068\u306a\u308a\u3001\u3088\u308a\u6d17\u7df4\u3055\u308c\u305fPHP\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u958b\u767a\u306b\u3064\u306a\u304c\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>PHP\u306e\u914d\u5217\u64cd\u4f5c\u306f\u3001\u5358\u306b\u30c7\u30fc\u30bf\u3092\u683c\u7d0d\u3059\u308b\u3060\u3051\u3067\u306a\u304f\u3001\u30c7\u30fc\u30bf\u3092\u52b9\u7387\u7684\u306b\u64cd\u4f5c\u30fb\u5909\u63db\u30fb\u5206\u6790\u3059\u308b\u305f\u3081\u306e\u5f37\u529b\u306a\u30c4\u30fc\u30eb\u3067\u3059\u3002\u672c\u8a18\u4e8b\u3067\u7d39\u4ecb\u3057\u305f7\u3064\u306e\u30c6\u30af\u30cb\u30c3\u30af\u3092\u99c6\u4f7f\u3057\u3066\u3001\u3088\u308a\u52b9\u7387\u7684\u3067\u5805\u7262\u306aPHP\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u958b\u767a\u3057\u307e\u3057\u3087\u3046\uff01<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3010PHP\u5165\u9580\u3011\u914d\u5217\u8981\u7d20\u6570\u306e\u30ab\u30a6\u30f3\u30c8\u30fb\u64cd\u4f5c\u3092\u5fb9\u5e95\u89e3\u8aac\uff017\u3064\u306e\u52b9\u7387\u7684\u30c6\u30af\u30cb\u30c3\u30af Warning: Undefined array key &#8220;is_admin&#8221; in \/home\/xs392991\/dexall.co.jp\/p &#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,63],"tags":[],"class_list":{"0":"post-3723","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-php","7":"category-php-syntax","8":"nothumb"},"_links":{"self":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts\/3723","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=3723"}],"version-history":[{"count":4,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts\/3723\/revisions"}],"predecessor-version":[{"id":3727,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts\/3723\/revisions\/3727"}],"wp:attachment":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3723"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3723"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3723"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}