{"id":746,"date":"2025-08-01T15:29:13","date_gmt":"2025-08-01T06:29:13","guid":{"rendered":"https:\/\/nexive.tech\/?p=746"},"modified":"2025-08-01T15:29:13","modified_gmt":"2025-08-01T06:29:13","slug":"%e3%80%90%e3%82%b5%e3%82%af%e3%83%83%e3%81%a8%e8%a7%a3%e8%aa%ac%e3%80%91php-%e9%85%8d%e5%88%97%e3%81%ae%e5%9f%ba%e6%9c%ac%e3%81%a8%e3%82%88%e3%81%8f%e4%bd%bf%e3%81%86%e6%93%8d%e4%bd%9c%e3%83%91","status":"publish","type":"post","link":"https:\/\/nexive.tech\/?p=746","title":{"rendered":"\u3010\u30b5\u30af\u30c3\u3068\u89e3\u8aac\u3011PHP \u914d\u5217\u306e\u57fa\u672c\u3068\u3088\u304f\u4f7f\u3046\u64cd\u4f5c\u30d1\u30bf\u30fc\u30f3"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">1. \u672c\u8a18\u4e8b\u306e\u30dd\u30a4\u30f3\u30c8<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>PHP\u306b\u304a\u3051\u308b\u914d\u5217\u306e\u57fa\u672c\u69cb\u6587\u3068\u4f7f\u3044\u65b9\u3092\u6574\u7406<\/li>\n\n\n\n<li>\u3088\u304f\u4f7f\u3046\u64cd\u4f5c\uff08\u8ffd\u52a0\u3001\u524a\u9664\u3001\u691c\u7d22\u3001\u7d50\u5408\u306a\u3069\uff09\u3092\u5177\u4f53\u7684\u306b\u7d39\u4ecb<\/li>\n\n\n\n<li>\u5b9f\u52d9\u3067\u3042\u308a\u304c\u3061\u306a\u30df\u30b9\u3084\u8a2d\u8a08\u5224\u65ad\u306e\u6ce8\u610f\u70b9\u3082\u89e3\u8aac<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">2. PHP\u306e\u914d\u5217\u3068\u306f\uff1f<\/h2>\n\n\n\n<p>PHP\u306e\u914d\u5217\uff08array\uff09\u306f\u3001\u8907\u6570\u306e\u5024\u30921\u3064\u306e\u5909\u6570\u3067\u307e\u3068\u3081\u3066\u6271\u3048\u308b\u67d4\u8edf\u306a\u30c7\u30fc\u30bf\u69cb\u9020\u3067\u3059\u3002\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u914d\u5217\u3001\u9023\u60f3\u914d\u5217\u3001\u305d\u3057\u3066\u305d\u306e\u6df7\u5728\u578b\u3068\u3044\u30463\u7a2e\u985e\u304c\u5b58\u5728\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u914d\u5217\u306f\u6570\u5024\u30ad\u30fc\u3001\u9023\u60f3\u914d\u5217\u306f\u6587\u5b57\u5217\u30ad\u30fc\u3092\u4f7f\u7528\u3057\u3001\u7528\u9014\u306b\u5fdc\u3058\u3066\u81ea\u7531\u306b\u5207\u308a\u66ff\u3048\u3089\u308c\u308b\u306e\u304c\u7279\u5fb4\u3067\u3059\u3002PHP\u306e\u914d\u5217\u306f\u5185\u90e8\u7684\u306b\u306f\u30cf\u30c3\u30b7\u30e5\u30c6\u30fc\u30d6\u30eb\u3068\u3057\u3066\u5b9f\u88c5\u3055\u308c\u3066\u304a\u308a\u3001\u30ad\u30fc\u306e\u578b\u306b\u67d4\u8edf\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u5b9f\u52d9\u3067\u306f\u3001\u30c7\u30fc\u30bf\u306e\u307e\u3068\u307e\u308a\uff08\u30ea\u30b9\u30c8\u3001\u8a2d\u5b9a\u60c5\u5831\u3001DB\u7d50\u679c\u306e\u4fdd\u6301\u306a\u3069\uff09\u3092\u6271\u3046\u5834\u9762\u3067\u5e83\u304f\u4f7f\u7528\u3055\u308c\u3066\u304a\u308a\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3084\u53ef\u8aad\u6027\u306e\u89b3\u70b9\u304b\u3089\u3082\u9069\u5207\u306a\u64cd\u4f5c\u304c\u6c42\u3081\u3089\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. \u8a73\u7d30\u89e3\u8aac<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u914d\u5217\u306e\u4f5c\u6210\u3068\u57fa\u672c\u30a2\u30af\u30bb\u30b9<\/h3>\n\n\n\n<p>\u3082\u3063\u3068\u3082\u57fa\u672c\u7684\u306a\u914d\u5217\u306e\u751f\u6210\u3068\u30a2\u30af\u30bb\u30b9\u65b9\u6cd5\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>\/\/ \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u914d\u5217\n$colors = &#91;\"red\", \"green\", \"blue\"&#93;;\necho $colors&#91;1&#93;; \/\/ \u51fa\u529b: green\n\n\/\/ \u9023\u60f3\u914d\u5217\n$user = &#91;\"name\" => \"Alice\", \"age\" => 30&#93;;\necho $user&#91;\"name\"&#93;; \/\/ \u51fa\u529b: Alice\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #6A9955\">\/\/ \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u914d\u5217<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$colors<\/span><span style=\"color: #D4D4D4\"> = &#91;<\/span><span style=\"color: #CE9178\">&quot;red&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&quot;green&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&quot;blue&quot;<\/span><span style=\"color: #D4D4D4\">&#93;;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">echo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$colors<\/span><span style=\"color: #D4D4D4\">&#91;<\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">&#93;; <\/span><span style=\"color: #6A9955\">\/\/ \u51fa\u529b: green<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ \u9023\u60f3\u914d\u5217<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$user<\/span><span style=\"color: #D4D4D4\"> = &#91;<\/span><span style=\"color: #CE9178\">&quot;name&quot;<\/span><span style=\"color: #D4D4D4\"> =&gt; <\/span><span style=\"color: #CE9178\">&quot;Alice&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&quot;age&quot;<\/span><span style=\"color: #D4D4D4\"> =&gt; <\/span><span style=\"color: #B5CEA8\">30<\/span><span style=\"color: #D4D4D4\">&#93;;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">echo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$user<\/span><span style=\"color: #D4D4D4\">&#91;<\/span><span style=\"color: #CE9178\">&quot;name&quot;<\/span><span style=\"color: #D4D4D4\">&#93;; <\/span><span style=\"color: #6A9955\">\/\/ \u51fa\u529b: Alice<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>PHP 5.4\u4ee5\u964d\u306f<code>array()<\/code>\u306e\u4ee3\u308f\u308a\u306b\u77ed\u7e2e\u69cb\u6587<code>[]<\/code>\u304c\u4f7f\u7528\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u8981\u7d20\u306e\u8ffd\u52a0\u3068\u524a\u9664<\/h3>\n\n\n\n<p>\u672b\u5c3e\u3078\u306e\u8ffd\u52a0\u3001\u7279\u5b9a\u8981\u7d20\u306e\u524a\u9664\u306b\u306f\u4ee5\u4e0b\u306e\u95a2\u6570\u304c\u4f7f\u308f\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>\/\/ \u8ffd\u52a0\n$colors[] = \"yellow\";\narray_push($colors, \"pink\");\n\n\/\/ \u524a\u9664\nunset($colors&#91;1&#93;); \/\/ \"green\"\u3092\u524a\u9664\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #6A9955\">\/\/ \u8ffd\u52a0<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$colors<\/span><span style=\"color: #D4D4D4\">[] = <\/span><span style=\"color: #CE9178\">&quot;yellow&quot;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">array_push<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$colors<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&quot;pink&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ \u524a\u9664<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">unset<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$colors<\/span><span style=\"color: #D4D4D4\">&#91;<\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">&#93;); <\/span><span style=\"color: #6A9955\">\/\/ &quot;green&quot;\u3092\u524a\u9664<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p><code>unset()<\/code>\u306f\u30ad\u30fc\u306e\u524a\u9664\u306e\u307f\u3067\u3001\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306f\u518d\u69cb\u6210\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u8981\u7d20\u306e\u5b58\u5728\u78ba\u8a8d\u3068\u691c\u7d22<\/h3>\n\n\n\n<p>\u5024\u3084\u30ad\u30fc\u306e\u5b58\u5728\u78ba\u8a8d\u306b\u306f\u4ee5\u4e0b\u3092\u7528\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>in_array(\"red\", $colors); \/\/ true\narray_key_exists(\"name\", $user); \/\/ true\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #DCDCAA\">in_array<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;red&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">$colors<\/span><span style=\"color: #D4D4D4\">); <\/span><span style=\"color: #6A9955\">\/\/ true<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">array_key_exists<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;name&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">$user<\/span><span style=\"color: #D4D4D4\">); <\/span><span style=\"color: #6A9955\">\/\/ true<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u5024\u306e\u4f4d\u7f6e\u3092\u691c\u7d22\u3057\u305f\u3044\u5834\u5408\u306f\u3001<code>array_search()<\/code>\u304c\u4fbf\u5229\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>$key = array_search(\"blue\", $colors); \/\/ \u51fa\u529b: 2\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">$key<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #DCDCAA\">array_search<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;blue&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">$colors<\/span><span style=\"color: #D4D4D4\">); <\/span><span style=\"color: #6A9955\">\/\/ \u51fa\u529b: 2<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u914d\u5217\u306e\u7d50\u5408\u3068\u5206\u89e3<\/h3>\n\n\n\n<p>\u914d\u5217\u3092\u9023\u7d50\u30fb\u5206\u5272\u3059\u308b\u5178\u578b\u7684\u306a\u65b9\u6cd5\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>\/\/ \u7d50\u5408\n$merged = array_merge($colors, &#91;\"black\", \"white\"&#93;);\n\n\/\/ \u5206\u5272\n$chunked = array_chunk($colors, 2);\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #6A9955\">\/\/ \u7d50\u5408<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$merged<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #DCDCAA\">array_merge<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$colors<\/span><span style=\"color: #D4D4D4\">, &#91;<\/span><span style=\"color: #CE9178\">&quot;black&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&quot;white&quot;<\/span><span style=\"color: #D4D4D4\">&#93;);<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ \u5206\u5272<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$chunked<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #DCDCAA\">array_chunk<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$colors<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #B5CEA8\">2<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u6587\u5b57\u5217\u3068\u914d\u5217\u306e\u76f8\u4e92\u5909\u63db\u3082\u3088\u304f\u4f7f\u308f\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>$str = \"a,b,c\";\n$arr = explode(\",\", $str);\n$joined = implode(\"-\", $arr); \/\/ \u51fa\u529b: a-b-c\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">$str<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #CE9178\">&quot;a,b,c&quot;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$arr<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #DCDCAA\">explode<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;,&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">$str<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$joined<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #DCDCAA\">implode<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;-&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">$arr<\/span><span style=\"color: #D4D4D4\">); <\/span><span style=\"color: #6A9955\">\/\/ \u51fa\u529b: a-b-c<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">4. \u3088\u304f\u3042\u308b\u30df\u30b9\u30fb\u8aa4\u89e3\u30fb\u843d\u3068\u3057\u7a74<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">unset\u5f8c\u306e\u914d\u5217\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u30ba\u30ec<\/h3>\n\n\n\n<p><code>unset()<\/code>\u3067\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u524a\u9664\u3057\u3066\u3082\u3001\u518d\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u5316\u3055\u308c\u307e\u305b\u3093\u3002\u305d\u306e\u305f\u3081\u3001<code>foreach<\/code>\u306a\u3069\u3067\u60f3\u5b9a\u5916\u306e\u6319\u52d5\u3092\u3059\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>$arr = &#91;\"a\", \"b\", \"c\"&#93;;\nunset($arr&#91;1&#93;);\nprint_r($arr);\n\/\/ \u51fa\u529b: Array ( &#91;0&#93; => a &#91;2&#93; => c )\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">$arr<\/span><span style=\"color: #D4D4D4\"> = &#91;<\/span><span style=\"color: #CE9178\">&quot;a&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&quot;b&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&quot;c&quot;<\/span><span style=\"color: #D4D4D4\">&#93;;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">unset<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$arr<\/span><span style=\"color: #D4D4D4\">&#91;<\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">&#93;);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">print_r<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$arr<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ \u51fa\u529b: Array ( &#91;0&#93; =&gt; a &#91;2&#93; =&gt; c )<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u5fc5\u8981\u306b\u5fdc\u3058\u3066<code>array_values()<\/code>\u3067\u518d\u69cb\u6210\u3059\u308b\u3053\u3068\u304c\u63a8\u5968\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u30ad\u30fc\u306e\u91cd\u8907\u3068\u4e0a\u66f8\u304d<\/h3>\n\n\n\n<p>\u9023\u60f3\u914d\u5217\u3067\u540c\u3058\u30ad\u30fc\u304c\u8907\u6570\u56de\u51fa\u73fe\u3059\u308b\u3068\u3001\u5f8c\u306e\u5024\u3067\u4e0a\u66f8\u304d\u3055\u308c\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u610f\u56f3\u3057\u306a\u3044\u30c7\u30fc\u30bf\u306e\u6d88\u5931\u304c\u767a\u751f\u3059\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>$arr = &#91;\"key\" => \"A\", \"key\" => \"B\"&#93;;\necho $arr&#91;\"key\"&#93;; \/\/ \u51fa\u529b: B\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">$arr<\/span><span style=\"color: #D4D4D4\"> = &#91;<\/span><span style=\"color: #CE9178\">&quot;key&quot;<\/span><span style=\"color: #D4D4D4\"> =&gt; <\/span><span style=\"color: #CE9178\">&quot;A&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&quot;key&quot;<\/span><span style=\"color: #D4D4D4\"> =&gt; <\/span><span style=\"color: #CE9178\">&quot;B&quot;<\/span><span style=\"color: #D4D4D4\">&#93;;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">echo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$arr<\/span><span style=\"color: #D4D4D4\">&#91;<\/span><span style=\"color: #CE9178\">&quot;key&quot;<\/span><span style=\"color: #D4D4D4\">&#93;; <\/span><span style=\"color: #6A9955\">\/\/ \u51fa\u529b: B<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u914d\u5217\u95a2\u6570\u306e\u623b\u308a\u5024\u3068\u526f\u4f5c\u7528<\/h3>\n\n\n\n<p>\u4e00\u90e8\u306e\u914d\u5217\u95a2\u6570\uff08\u4f8b\uff1a<code>array_splice()<\/code>\uff09\u306f\u5f15\u6570\u3092\u76f4\u63a5\u5909\u66f4\u3057\u307e\u3059\u3002\u623b\u308a\u5024\u3068\u64cd\u4f5c\u5bfe\u8c61\u306e\u4e21\u65b9\u306b\u6ce8\u610f\u3092\u6255\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5. \u307e\u3068\u3081<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u914d\u5217\u306f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u914d\u5217\u30fb\u9023\u60f3\u914d\u5217\u3092\u4e2d\u5fc3\u306b\u67d4\u8edf\u306b\u4f7f\u3048\u308b\u69cb\u9020<\/li>\n\n\n\n<li>\u8ffd\u52a0\u30fb\u524a\u9664\u30fb\u691c\u7d22\u30fb\u7d50\u5408\u306a\u3069\u306e\u64cd\u4f5c\u30d1\u30bf\u30fc\u30f3\u3092\u9069\u5207\u306b\u4f7f\u3044\u5206\u3051\u308b<\/li>\n\n\n\n<li>unset\u5f8c\u306e\u518d\u69cb\u6210\u3001\u30ad\u30fc\u91cd\u8907\u3001\u95a2\u6570\u306e\u526f\u4f5c\u7528\u306b\u6ce8\u610f\u304c\u5fc5\u8981<\/li>\n\n\n\n<li>\u5b9f\u52d9\u3067\u306f\u660e\u793a\u7684\u306a\u610f\u56f3\u304c\u4f1d\u308f\u308b\u8a18\u8ff0\u304c\u91cd\u8981<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>1. \u672c\u8a18\u4e8b\u306e\u30dd\u30a4\u30f3\u30c8 2. PHP\u306e\u914d\u5217\u3068\u306f\uff1f PHP\u306e\u914d\u5217\uff08array\uff09\u306f\u3001\u8907\u6570\u306e\u5024\u30921\u3064\u306e\u5909\u6570\u3067\u307e\u3068\u3081\u3066\u6271\u3048\u308b\u67d4\u8edf\u306a\u30c7\u30fc\u30bf\u69cb\u9020\u3067\u3059\u3002\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u914d\u5217\u3001\u9023\u60f3\u914d\u5217\u3001\u305d\u3057\u3066\u305d\u306e\u6df7\u5728\u578b\u3068\u3044\u30463\u7a2e\u985e\u304c\u5b58\u5728\u3057\u307e\u3059\u3002 \u30a4\u30f3\u30c7\u30c3\u30af [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":451,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[85],"tags":[],"class_list":["post-746","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php"],"_links":{"self":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/746","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=746"}],"version-history":[{"count":1,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/746\/revisions"}],"predecessor-version":[{"id":747,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/746\/revisions\/747"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/media\/451"}],"wp:attachment":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=746"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=746"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=746"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}