{"id":748,"date":"2025-08-01T15:31:16","date_gmt":"2025-08-01T06:31:16","guid":{"rendered":"https:\/\/nexive.tech\/?p=748"},"modified":"2025-08-01T15:31:17","modified_gmt":"2025-08-01T06:31:17","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%80%a3%e6%83%b3%e9%85%8d%e5%88%97%e3%81%a8%e5%a4%9a%e6%ac%a1%e5%85%83%e9%85%8d%e5%88%97%e3%81%ae%e6%89%b1%e3%81%84","status":"publish","type":"post","link":"https:\/\/nexive.tech\/?p=748","title":{"rendered":"\u3010\u30b5\u30af\u30c3\u3068\u89e3\u8aac\u3011PHP \u9023\u60f3\u914d\u5217\u3068\u591a\u6b21\u5143\u914d\u5217\u306e\u6271\u3044\u65b9"},"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\u306e\u9023\u60f3\u914d\u5217\u3068\u591a\u6b21\u5143\u914d\u5217\u306e\u57fa\u672c\u69cb\u9020\u3068\u4f7f\u3044\u65b9\u3092\u6574\u7406<\/li>\n\n\n\n<li>\u5b9f\u52d9\u3067\u3088\u304f\u4f7f\u3046\u30a2\u30af\u30bb\u30b9\u3001\u64cd\u4f5c\u3001\u521d\u671f\u5316\u30d1\u30bf\u30fc\u30f3\u3092\u5177\u4f53\u7684\u306b\u7d39\u4ecb<\/li>\n\n\n\n<li>\u5165\u308c\u5b50\u69cb\u9020\u306e\u6271\u3044\u306b\u304a\u3051\u308b\u6ce8\u610f\u70b9\u3084\u843d\u3068\u3057\u7a74\u3082\u89e3\u8aac<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">2. PHP\u306e\u9023\u60f3\u914d\u5217\u3068\u591a\u6b21\u5143\u914d\u5217\u3068\u306f\uff1f<\/h2>\n\n\n\n<p>\u9023\u60f3\u914d\u5217\u306f\u3001\u6587\u5b57\u5217\u30ad\u30fc\u3068\u5024\u306e\u30da\u30a2\u3067\u69cb\u6210\u3055\u308c\u308b\u914d\u5217\u3067\u3059\u3002JSON\u3084DB\u306e\u7d50\u679c\u306e\u3088\u3046\u306a\u69cb\u9020\u5316\u30c7\u30fc\u30bf\u3092\u6271\u3046\u969b\u306b\u3088\u304f\u4f7f\u308f\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u4e00\u65b9\u3001\u591a\u6b21\u5143\u914d\u5217\u306f\u3001\u914d\u5217\u306e\u4e2d\u306b\u3055\u3089\u306b\u914d\u5217\u3092\u683c\u7d0d\u3057\u305f\u69cb\u9020\u3067\u3059\u30022\u6b21\u5143\u8868\u306e\u3088\u3046\u306a\u30c7\u30fc\u30bf\u3084\u3001\u968e\u5c64\u69cb\u9020\u306e\u60c5\u5831\u3092\u6301\u3064\u5834\u5408\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>PHP\u3067\u306f\u914d\u5217\u306e\u578b\u306b\u5236\u7d04\u304c\u5c11\u306a\u3044\u305f\u3081\u3001\u9023\u60f3\u914d\u5217\u3068\u591a\u6b21\u5143\u914d\u5217\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u67d4\u8edf\u306a\u69cb\u9020\u3092\u69cb\u7bc9\u3067\u304d\u307e\u3059\u3002\u305f\u3060\u3057\u3001\u69cb\u9020\u304c\u8907\u96d1\u306b\u306a\u308b\u3068\u8aad\u307f\u3065\u3089\u304f\u3001\u30d0\u30b0\u306e\u6e29\u5e8a\u306b\u3082\u306a\u308b\u305f\u3081\u3001\u6b63\u78ba\u306a\u30a2\u30af\u30bb\u30b9\u3068\u69cb\u9020\u306e\u628a\u63e1\u304c\u91cd\u8981\u3067\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\">\u9023\u60f3\u914d\u5217\u306e\u5b9a\u7fa9\u3068\u30a2\u30af\u30bb\u30b9<\/h3>\n\n\n\n<p>\u9023\u60f3\u914d\u5217\u306e\u30ad\u30fc\u306b\u306f\u4efb\u610f\u306e\u6587\u5b57\u5217\u304c\u4f7f\u3048\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>$user = &#91;\n    \"name\" => \"Alice\",\n    \"email\" => \"alice@example.com\",\n    \"age\" => 30\n&#93;;\necho $user&#91;\"email\"&#93;;\n\/\/ \u51fa\u529b: alice@example.com\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\">$user<\/span><span style=\"color: #D4D4D4\"> = &#91;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/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>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #CE9178\">&quot;email&quot;<\/span><span style=\"color: #D4D4D4\"> =&gt; <\/span><span style=\"color: #CE9178\">&quot;alice@example.com&quot;<\/span><span style=\"color: #D4D4D4\">,<\/span><\/span>\n<span class=\"line\"><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>\n<span class=\"line\"><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;email&quot;<\/span><span style=\"color: #D4D4D4\">&#93;;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ \u51fa\u529b: alice@example.com<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u30ad\u30fc\u304c\u5b58\u5728\u3057\u306a\u3044\u5834\u5408\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068<code>undefined index<\/code>\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u3002\u4e8b\u524d\u306b<code>array_key_exists()<\/code>\u3084<code>isset()<\/code>\u3067\u78ba\u8a8d\u3059\u308b\u306e\u304c\u5b89\u5168\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u591a\u6b21\u5143\u914d\u5217\u306e\u521d\u671f\u5316\u3068\u30a2\u30af\u30bb\u30b9<\/h3>\n\n\n\n<p>\u591a\u6b21\u5143\u914d\u5217\u306f\u3001\u9023\u60f3\u914d\u5217\u30fb\u6570\u5024\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u914d\u5217\u3092\u81ea\u7531\u306b\u7d44\u307f\u5408\u308f\u305b\u3089\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>$users = [\n    &#91;\"id\" => 1, \"name\" => \"Alice\"&#93;,\n    &#91;\"id\" => 2, \"name\" => \"Bob\"&#93;,\n];\necho $users&#91;1&#93;&#91;\"name\"&#93;;\n\/\/ \u51fa\u529b: Bob\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\">$users<\/span><span style=\"color: #D4D4D4\"> = [<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    &#91;<\/span><span style=\"color: #CE9178\">&quot;id&quot;<\/span><span style=\"color: #D4D4D4\"> =&gt; <\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">, <\/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\">&#93;,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    &#91;<\/span><span style=\"color: #CE9178\">&quot;id&quot;<\/span><span style=\"color: #D4D4D4\"> =&gt; <\/span><span style=\"color: #B5CEA8\">2<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&quot;name&quot;<\/span><span style=\"color: #D4D4D4\"> =&gt; <\/span><span style=\"color: #CE9178\">&quot;Bob&quot;<\/span><span style=\"color: #D4D4D4\">&#93;,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">];<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">echo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$users<\/span><span style=\"color: #D4D4D4\">&#91;<\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">&#93;&#91;<\/span><span style=\"color: #CE9178\">&quot;name&quot;<\/span><span style=\"color: #D4D4D4\">&#93;;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ \u51fa\u529b: Bob<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u30ad\u30fc\u304c\u4e00\u6bb5\u3067\u3082\u5b58\u5728\u3057\u306a\u3044\u5834\u5408\u3001\u8b66\u544a\u304c\u51fa\u308b\u305f\u3081\u9010\u6b21\u30c1\u30a7\u30c3\u30af\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u591a\u6b21\u5143\u9023\u60f3\u914d\u5217\u306e\u69cb\u7bc9\u3068\u30eb\u30fc\u30d7\u51e6\u7406<\/h3>\n\n\n\n<p>\u3088\u308a\u8907\u96d1\u306a\u69cb\u9020\u3092\u6301\u3064\u914d\u5217\u3067\u306f\u3001\u30eb\u30fc\u30d7\u3067\u306e\u30a2\u30af\u30bb\u30b9\u65b9\u6cd5\u3082\u5de5\u592b\u304c\u5fc5\u8981\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(2 * 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>$products = [\n    \"book\" => &#91;\"title\" => \"PHP\u5165\u9580\", \"price\" => 1200&#93;,\n    \"pen\" => &#91;\"title\" => \"\u30dc\u30fc\u30eb\u30da\u30f3\", \"price\" => 100&#93;\n];\n\nforeach ($products as $key => $info) {\n    echo $key . \": \" . $info&#91;\"title\"&#93; . \" (\" . $info&#91;\"price\"&#93; . \")\\n\";\n}\n\/\/ \u51fa\u529b:\n\/\/ book: PHP\u5165\u9580 (1200)\n\/\/ pen: \u30dc\u30fc\u30eb\u30da\u30f3 (100)\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\">$products<\/span><span style=\"color: #D4D4D4\"> = [<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #CE9178\">&quot;book&quot;<\/span><span style=\"color: #D4D4D4\"> =&gt; &#91;<\/span><span style=\"color: #CE9178\">&quot;title&quot;<\/span><span style=\"color: #D4D4D4\"> =&gt; <\/span><span style=\"color: #CE9178\">&quot;PHP\u5165\u9580&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&quot;price&quot;<\/span><span style=\"color: #D4D4D4\"> =&gt; <\/span><span style=\"color: #B5CEA8\">1200<\/span><span style=\"color: #D4D4D4\">&#93;,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #CE9178\">&quot;pen&quot;<\/span><span style=\"color: #D4D4D4\"> =&gt; &#91;<\/span><span style=\"color: #CE9178\">&quot;title&quot;<\/span><span style=\"color: #D4D4D4\"> =&gt; <\/span><span style=\"color: #CE9178\">&quot;\u30dc\u30fc\u30eb\u30da\u30f3&quot;<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #CE9178\">&quot;price&quot;<\/span><span style=\"color: #D4D4D4\"> =&gt; <\/span><span style=\"color: #B5CEA8\">100<\/span><span style=\"color: #D4D4D4\">&#93;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">];<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">foreach<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #9CDCFE\">$products<\/span><span style=\"color: #D4D4D4\"> as <\/span><span style=\"color: #9CDCFE\">$key<\/span><span style=\"color: #D4D4D4\"> =&gt; <\/span><span style=\"color: #9CDCFE\">$info<\/span><span style=\"color: #D4D4D4\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #DCDCAA\">echo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$key<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;: &quot;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$info<\/span><span style=\"color: #D4D4D4\">&#91;<\/span><span style=\"color: #CE9178\">&quot;title&quot;<\/span><span style=\"color: #D4D4D4\">&#93; <\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot; (&quot;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$info<\/span><span style=\"color: #D4D4D4\">&#91;<\/span><span style=\"color: #CE9178\">&quot;price&quot;<\/span><span style=\"color: #D4D4D4\">&#93; <\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;)<\/span><span style=\"color: #D7BA7D\">\\n<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ \u51fa\u529b:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ book: PHP\u5165\u9580 (1200)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ pen: \u30dc\u30fc\u30eb\u30da\u30f3 (100)<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u30cd\u30b9\u30c8\u69cb\u9020\u306e\u914d\u5217\u8981\u7d20\u3092\u8ffd\u52a0\u30fb\u66f4\u65b0<\/h3>\n\n\n\n<p>\u52d5\u7684\u306b\u5024\u3092\u8ffd\u52a0\u3059\u308b\u5834\u5408\u3082\u30b7\u30f3\u30d7\u30eb\u306b\u8a18\u8ff0\u3067\u304d\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>$data = [];\n$data&#91;\"user\"&#93;&#91;\"name\"&#93; = \"Charlie\";\n$data&#91;\"user\"&#93;&#91;\"email\"&#93; = \"charlie@example.com\";\nprint_r($data);\n\/\/ \u51fa\u529b:\n\/\/ Array ( &#91;user&#93; => Array ( &#91;name&#93; => Charlie &#91;email&#93; => charlie@example.com ) )\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\">$data<\/span><span style=\"color: #D4D4D4\"> = [];<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$data<\/span><span style=\"color: #D4D4D4\">&#91;<\/span><span style=\"color: #CE9178\">&quot;user&quot;<\/span><span style=\"color: #D4D4D4\">&#93;&#91;<\/span><span style=\"color: #CE9178\">&quot;name&quot;<\/span><span style=\"color: #D4D4D4\">&#93; = <\/span><span style=\"color: #CE9178\">&quot;Charlie&quot;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$data<\/span><span style=\"color: #D4D4D4\">&#91;<\/span><span style=\"color: #CE9178\">&quot;user&quot;<\/span><span style=\"color: #D4D4D4\">&#93;&#91;<\/span><span style=\"color: #CE9178\">&quot;email&quot;<\/span><span style=\"color: #D4D4D4\">&#93; = <\/span><span style=\"color: #CE9178\">&quot;charlie@example.com&quot;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">print_r<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$data<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ \u51fa\u529b:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ Array ( &#91;user&#93; =&gt; Array ( &#91;name&#93; =&gt; Charlie &#91;email&#93; =&gt; charlie@example.com ) )<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u672a\u5b9a\u7fa9\u30ad\u30fc\u3078\u306e\u76f4\u63a5\u4ee3\u5165\u3082\u53ef\u80fd\u3067\u3059\u304c\u3001\u610f\u56f3\u3057\u306a\u3044\u69cb\u9020\u306b\u306a\u308b\u5834\u5408\u304c\u3042\u308b\u305f\u3081\u3001\u8a2d\u8a08\u610f\u56f3\u306b\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\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\">\u5b58\u5728\u3057\u306a\u3044\u30ad\u30fc\u3078\u306e\u30a2\u30af\u30bb\u30b9<\/h3>\n\n\n\n<p>\u591a\u6b21\u5143\u914d\u5217\u3067\u306f\u3001\u9014\u4e2d\u306e\u30ad\u30fc\u304c\u5b58\u5728\u3057\u306a\u3044\u3068\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u3002\u7279\u306b\u30d5\u30a9\u30fc\u30e0\u30c7\u30fc\u30bf\u3084API\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u6271\u3046\u969b\u306f\u3001<code>isset()<\/code>\u3084<code>??<\/code>\uff08null\u5408\u4f53\u6f14\u7b97\u5b50\uff09\u3092\u4f75\u7528\u3057\u307e\u3057\u3087\u3046\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>echo $user&#91;\"address\"&#93;&#91;\"city\"&#93; ?? \"\u4e0d\u660e\";\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\">echo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$user<\/span><span style=\"color: #D4D4D4\">&#91;<\/span><span style=\"color: #CE9178\">&quot;address&quot;<\/span><span style=\"color: #D4D4D4\">&#93;&#91;<\/span><span style=\"color: #CE9178\">&quot;city&quot;<\/span><span style=\"color: #D4D4D4\">&#93; ?? <\/span><span style=\"color: #CE9178\">&quot;\u4e0d\u660e&quot;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">foreach\u3067\u306e\u8aa4\u3063\u305f\u30cd\u30b9\u30c8\u51e6\u7406<\/h3>\n\n\n\n<p>\u968e\u5c64\u304c\u6df1\u3044\u914d\u5217\u3092<code>foreach<\/code>\u3067\u51e6\u7406\u3059\u308b\u969b\u3001\u30eb\u30fc\u30d7\u69cb\u9020\u3092\u9593\u9055\u3048\u308b\u3068\u60f3\u5b9a\u5916\u306e\u5024\u304c\u53d6\u308a\u51fa\u3055\u308c\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u914d\u5217\u306e\u968e\u5c64\u69cb\u9020\u3092\u6b63\u78ba\u306b\u628a\u63e1\u3057\u305f\u4e0a\u3067\u30011\u968e\u5c64\u305a\u3064\u5c55\u958b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u53ef\u8aad\u6027\u306e\u4f4e\u4e0b<\/h3>\n\n\n\n<p>\u5165\u308c\u5b50\u304c\u6df1\u3059\u304e\u308b\u69cb\u9020\u306f\u3001\u4fdd\u5b88\u6027\u304c\u4e0b\u304c\u308b\u539f\u56e0\u306b\u306a\u308a\u307e\u3059\u3002\u9069\u5207\u306b\u5206\u5272\u3057\u3001\u95a2\u6570\u5316\u3084\u30af\u30e9\u30b9\u5316\u3067\u8cac\u4efb\u7bc4\u56f2\u3092\u660e\u793a\u3057\u307e\u3057\u3087\u3046\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>\u9023\u60f3\u914d\u5217\u306f\u6587\u5b57\u5217\u30ad\u30fc\u306b\u3088\u308b\u67d4\u8edf\u306a\u30c7\u30fc\u30bf\u69cb\u9020\u3092\u63d0\u4f9b<\/li>\n\n\n\n<li>\u591a\u6b21\u5143\u914d\u5217\u306f\u968e\u5c64\u7684\u306a\u30c7\u30fc\u30bf\u3092\u8868\u73fe\u3059\u308b\u306e\u306b\u6709\u52b9<\/li>\n\n\n\n<li>\u5b58\u5728\u78ba\u8a8d\u3084\u69cb\u9020\u306e\u660e\u78ba\u5316\u306b\u6ce8\u610f\u3057\u3001\u610f\u56f3\u306e\u3042\u308b\u8a2d\u8a08\u3092\u5fc3\u304c\u3051\u308b<\/li>\n\n\n\n<li>\u30cd\u30b9\u30c8\u69cb\u9020\u306e\u914d\u5217\u306f\u6b63\u78ba\u306a\u30a2\u30af\u30bb\u30b9\u3068\u9069\u5207\u306a\u30eb\u30fc\u30d7\u304c\u5fc5\u9808<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>1. \u672c\u8a18\u4e8b\u306e\u30dd\u30a4\u30f3\u30c8 2. PHP\u306e\u9023\u60f3\u914d\u5217\u3068\u591a\u6b21\u5143\u914d\u5217\u3068\u306f\uff1f \u9023\u60f3\u914d\u5217\u306f\u3001\u6587\u5b57\u5217\u30ad\u30fc\u3068\u5024\u306e\u30da\u30a2\u3067\u69cb\u6210\u3055\u308c\u308b\u914d\u5217\u3067\u3059\u3002JSON\u3084DB\u306e\u7d50\u679c\u306e\u3088\u3046\u306a\u69cb\u9020\u5316\u30c7\u30fc\u30bf\u3092\u6271\u3046\u969b\u306b\u3088\u304f\u4f7f\u308f\u308c\u307e\u3059\u3002 \u4e00\u65b9\u3001\u591a\u6b21\u5143\u914d\u5217\u306f\u3001\u914d\u5217\u306e\u4e2d\u306b\u3055 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":454,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[85],"tags":[],"class_list":["post-748","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\/748","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=748"}],"version-history":[{"count":1,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/748\/revisions"}],"predecessor-version":[{"id":749,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/748\/revisions\/749"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/media\/454"}],"wp:attachment":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=748"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=748"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}