{"id":763,"date":"2025-08-04T16:07:57","date_gmt":"2025-08-04T07:07:57","guid":{"rendered":"https:\/\/nexive.tech\/?p=763"},"modified":"2025-08-04T16:07:57","modified_gmt":"2025-08-04T07:07:57","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-%e8%87%aa%e4%bd%9c%e9%96%a2%e6%95%b0%e3%81%ae%e4%bd%9c%e3%82%8a%e6%96%b9%e3%81%a8%e5%bc%95%e6%95%b0%e3%83%bb%e6%88%bb","status":"publish","type":"post","link":"https:\/\/nexive.tech\/?p=763","title":{"rendered":"\u3010\u30b5\u30af\u30c3\u3068\u89e3\u8aac\u3011PHP \u81ea\u4f5c\u95a2\u6570\u306e\u4f5c\u308a\u65b9\u3068\u5f15\u6570\u30fb\u623b\u308a\u5024\u306e\u57fa\u672c"},"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\u3067\u81ea\u4f5c\u95a2\u6570\u3092\u4f5c\u308b\u57fa\u672c\u69cb\u6587\u3068\u8a2d\u8a08\u306e\u8003\u3048\u65b9\u3092\u89e3\u8aac<\/li>\n\n\n\n<li>\u5f15\u6570\u3068\u623b\u308a\u5024\u306e\u4ed5\u69d8\u3068\u4f7f\u3044\u5206\u3051\u65b9\u3092\u5b9f\u884c\u4f8b\u4ed8\u304d\u3067\u7d39\u4ecb<\/li>\n\n\n\n<li>\u5b9f\u52d9\u3067\u306e\u95a2\u6570\u8a2d\u8a08\u306b\u304a\u3051\u308b\u6ce8\u610f\u70b9\u3084\u843d\u3068\u3057\u7a74\u3082\u88dc\u8db3<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">2. PHP\u306e\u81ea\u4f5c\u95a2\u6570\u3068\u306f\uff1f<\/h2>\n\n\n\n<p>PHP\u306b\u304a\u3051\u308b\u95a2\u6570\u306f\u3001\u4e00\u9023\u306e\u51e6\u7406\u3092\u307e\u3068\u3081\u3066\u518d\u5229\u7528\u53ef\u80fd\u306b\u3059\u308b\u305f\u3081\u306e\u4ed5\u7d44\u307f\u3067\u3059\u3002\u7d44\u307f\u8fbc\u307f\u95a2\u6570\u306b\u52a0\u3048\u3001\u958b\u767a\u8005\u304c\u72ec\u81ea\u306b\u5b9a\u7fa9\u3059\u308b\u300c\u30e6\u30fc\u30b6\u30fc\u5b9a\u7fa9\u95a2\u6570\uff08\u81ea\u4f5c\u95a2\u6570\uff09\u300d\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u51e6\u7406\u306e\u5171\u901a\u5316\u3084\u53ef\u8aad\u6027\u306e\u5411\u4e0a\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u95a2\u6570\u306f\u7279\u306b\u3001\u540c\u3058\u51e6\u7406\u3092\u8907\u6570\u306e\u5834\u6240\u3067\u4f7f\u3044\u305f\u3044\u5834\u5408\u3084\u3001\u51e6\u7406\u306e\u69cb\u9020\u3092\u660e\u78ba\u306b\u5206\u96e2\u3057\u305f\u3044\u3068\u304d\u306b\u6709\u52b9\u3067\u3059\u3002\u5f15\u6570\uff08\u30d1\u30e9\u30e1\u30fc\u30bf\uff09\u3092\u901a\u3058\u3066\u5916\u90e8\u304b\u3089\u5024\u3092\u53d7\u3051\u53d6\u308a\u3001\u623b\u308a\u5024\u3068\u3057\u3066\u51e6\u7406\u7d50\u679c\u3092\u8fd4\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>PHP\u306e\u95a2\u6570\u5b9a\u7fa9\u306f\u30b0\u30ed\u30fc\u30d0\u30eb\u30b9\u30b3\u30fc\u30d7\u3067\u3042\u308c\u3070\u3069\u3053\u3067\u3082\u53ef\u80fd\u3067\u3059\u304c\u3001\u95a2\u6570\u306e\u518d\u5b9a\u7fa9\u306f\u7981\u6b62\u3055\u308c\u3066\u304a\u308a\u3001\u540c\u540d\u306e\u95a2\u6570\u304c\u3059\u3067\u306b\u5b58\u5728\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u3002\u305d\u306e\u305f\u3081\u3001\u95a2\u6570\u540d\u306e\u547d\u540d\u306b\u306f\u6ce8\u610f\u304c\u5fc5\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\">\u57fa\u672c\u7684\u306a\u81ea\u4f5c\u95a2\u6570\u306e\u5b9a\u7fa9\u3068\u547c\u3073\u51fa\u3057<\/h3>\n\n\n\n<p>\u6700\u3082\u57fa\u672c\u7684\u306a\u69cb\u6587\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\uff1a<\/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>&lt;?php\nfunction sayHello() {\n    echo \"\u3053\u3093\u306b\u3061\u306f\uff01\\n\";\n}\n\nsayHello(); \/\/ => \u3053\u3093\u306b\u3061\u306f\uff01\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: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">function<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">sayHello<\/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: #CE9178\">&quot;\u3053\u3093\u306b\u3061\u306f\uff01<\/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>\n<span class=\"line\"><span style=\"color: #DCDCAA\">sayHello<\/span><span style=\"color: #D4D4D4\">(); <\/span><span style=\"color: #6A9955\">\/\/ =&gt; \u3053\u3093\u306b\u3061\u306f\uff01<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p><code>function<\/code> \u30ad\u30fc\u30ef\u30fc\u30c9\u3067\u95a2\u6570\u3092\u5b9a\u7fa9\u3057\u3001\u95a2\u6570\u540d\u306e\u5f8c\u306b\u4e38\u62ec\u5f27\u3068\u6ce2\u62ec\u5f27\u3067\u56f2\u3093\u3060\u672c\u4f53\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002\u95a2\u6570\u306f\u5b9a\u7fa9\u5f8c\u306b\u547c\u3073\u51fa\u3059\u3053\u3068\u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5f15\u6570\u3092\u4f7f\u3063\u305f\u95a2\u6570<\/h3>\n\n\n\n<p>\u5f15\u6570\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u5916\u90e8\u304b\u3089\u5024\u3092\u53d7\u3051\u53d6\u3063\u3066\u51e6\u7406\u306b\u6d3b\u7528\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>&lt;?php\nfunction greet($name) {\n    echo \"\u3053\u3093\u306b\u3061\u306f\u3001{$name}\u3055\u3093\uff01\\n\";\n}\n\ngreet(\"\u7530\u4e2d\"); \/\/ => \u3053\u3093\u306b\u3061\u306f\u3001\u7530\u4e2d\u3055\u3093\uff01\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: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">function<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">greet<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$name<\/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: #CE9178\">&quot;\u3053\u3093\u306b\u3061\u306f\u3001{<\/span><span style=\"color: #9CDCFE\">$name<\/span><span style=\"color: #CE9178\">}\u3055\u3093\uff01<\/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>\n<span class=\"line\"><span style=\"color: #DCDCAA\">greet<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;\u7530\u4e2d&quot;<\/span><span style=\"color: #D4D4D4\">); <\/span><span style=\"color: #6A9955\">\/\/ =&gt; \u3053\u3093\u306b\u3061\u306f\u3001\u7530\u4e2d\u3055\u3093\uff01<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u95a2\u6570\u5b9a\u7fa9\u306e\u62ec\u5f27\u5185\u306b\u5909\u6570\u3092\u8a18\u8ff0\u3059\u308b\u3053\u3068\u3067\u3001\u547c\u3073\u51fa\u3057\u6642\u306b\u5024\u3092\u6e21\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002PHP\u3067\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u5f15\u6570\u3082\u6307\u5b9a\u53ef\u80fd\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>&lt;?php\nfunction greetWithDefault($name = \"\u30b2\u30b9\u30c8\") {\n    echo \"\u3088\u3046\u3053\u305d\u3001{$name}\u3055\u3093\uff01\\n\";\n}\n\ngreetWithDefault(); \/\/ => \u3088\u3046\u3053\u305d\u3001\u30b2\u30b9\u30c8\u3055\u3093\uff01\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: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">function<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">greetWithDefault<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$name<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #CE9178\">&quot;\u30b2\u30b9\u30c8&quot;<\/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: #CE9178\">&quot;\u3088\u3046\u3053\u305d\u3001{<\/span><span style=\"color: #9CDCFE\">$name<\/span><span style=\"color: #CE9178\">}\u3055\u3093\uff01<\/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>\n<span class=\"line\"><span style=\"color: #DCDCAA\">greetWithDefault<\/span><span style=\"color: #D4D4D4\">(); <\/span><span style=\"color: #6A9955\">\/\/ =&gt; \u3088\u3046\u3053\u305d\u3001\u30b2\u30b9\u30c8\u3055\u3093\uff01<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u623b\u308a\u5024\u3092\u8fd4\u3059\u95a2\u6570<\/h3>\n\n\n\n<p>\u623b\u308a\u5024\u304c\u3042\u308b\u95a2\u6570\u306f <code>return<\/code> \u3092\u7528\u3044\u3066\u7d50\u679c\u3092\u547c\u3073\u51fa\u3057\u5143\u306b\u8fd4\u3057\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>&lt;?php\nfunction add($a, $b) {\n    return $a + $b;\n}\n\n$result = add(3, 5);\necho $result; \/\/ => 8\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: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">function<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">add<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$a<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">$b<\/span><span style=\"color: #D4D4D4\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$a<\/span><span style=\"color: #D4D4D4\"> + <\/span><span style=\"color: #9CDCFE\">$b<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$result<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #DCDCAA\">add<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #B5CEA8\">3<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #B5CEA8\">5<\/span><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\">$result<\/span><span style=\"color: #D4D4D4\">; <\/span><span style=\"color: #6A9955\">\/\/ =&gt; 8<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u623b\u308a\u5024\u306f\u3001\u95a2\u6570\u547c\u3073\u51fa\u3057\u90e8\u5206\u3067\u5909\u6570\u306b\u4ee3\u5165\u3057\u305f\u308a\u3001\u4ed6\u306e\u5f0f\u306b\u7d44\u307f\u8fbc\u3093\u3067\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">return \u306e\u526f\u4f5c\u7528\u3068\u6ce8\u610f\u70b9<\/h3>\n\n\n\n<p><code>return<\/code> \u3092\u4f7f\u3046\u3068\u3001\u305d\u306e\u6642\u70b9\u3067\u95a2\u6570\u306e\u51e6\u7406\u306f\u7d42\u4e86\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3001<code>return<\/code> \u4ee5\u964d\u306e\u51e6\u7406\u306f\u5b9f\u884c\u3055\u308c\u307e\u305b\u3093\uff1a<\/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>&lt;?php\nfunction testReturn() {\n    return \"\u5b8c\u4e86\";\n    echo \"\u3053\u306e\u884c\u306f\u5b9f\u884c\u3055\u308c\u307e\u305b\u3093\";\n}\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: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">function<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">testReturn<\/span><span style=\"color: #D4D4D4\">() {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;\u5b8c\u4e86&quot;<\/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: #CE9178\">&quot;\u3053\u306e\u884c\u306f\u5b9f\u884c\u3055\u308c\u307e\u305b\u3093&quot;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/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<ul class=\"wp-block-list\">\n<li><strong>return \u306e\u8a18\u8ff0\u6f0f\u308c<\/strong>\uff1a\u623b\u308a\u5024\u304c\u5fc5\u8981\u306a\u95a2\u6570\u3067 <code>return<\/code> \u3092\u5fd8\u308c\u308b\u3068 <code>null<\/code> \u304c\u8fd4\u308a\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u578b\u306e\u4e0d\u4e00\u81f4<\/strong>\uff1aPHP 7\u4ee5\u964d\u3067\u306f\u578b\u6307\u5b9a\u304c\u53ef\u80fd\u3067\u3059\u304c\u3001\u6307\u5b9a\u3057\u305f\u578b\u3068\u7570\u306a\u308b\u5024\u3092\u8fd4\u3059\u3068 TypeError \u306b\u306a\u308a\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u95a2\u6570\u540d\u306e\u91cd\u8907<\/strong>\uff1a\u540c\u540d\u306e\u95a2\u6570\u3092\u518d\u5b9a\u7fa9\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u81f4\u547d\u7684\u30a8\u30e9\u30fc\u3068\u306a\u308a\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u30b9\u30b3\u30fc\u30d7\u306e\u6df7\u540c<\/strong>\uff1a\u95a2\u6570\u5185\u3067\u5b9a\u7fa9\u3057\u305f\u5909\u6570\u306f\u539f\u5247\u3068\u3057\u3066\u95a2\u6570\u5916\u304b\u3089\u53c2\u7167\u3067\u304d\u307e\u305b\u3093\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u4ee5\u4e0b\u306f\u578b\u6307\u5b9a\u30df\u30b9\u306e\u4f8b\u3067\u3059\uff1a<\/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>&lt;?php\ndeclare(strict_types=1);\nfunction multiply(int $a, int $b): int {\n    return $a * $b;\n}\n\n\/\/ multiply(\"2\", \"3\"); \/\/ => TypeError\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: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">declare<\/span><span style=\"color: #D4D4D4\">(strict_types=<\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">function<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">multiply<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #569CD6\">int<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$a<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #569CD6\">int<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$b<\/span><span style=\"color: #D4D4D4\">): <\/span><span style=\"color: #569CD6\">int<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$a<\/span><span style=\"color: #D4D4D4\"> * <\/span><span style=\"color: #9CDCFE\">$b<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ multiply(&quot;2&quot;, &quot;3&quot;); \/\/ =&gt; TypeError<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">5. \u307e\u3068\u3081<\/h2>\n\n\n\n<p>PHP\u306e\u81ea\u4f5c\u95a2\u6570\u306f\u3001\u51e6\u7406\u306e\u518d\u5229\u7528\u3084\u69cb\u9020\u306e\u6574\u7406\u306b\u6709\u52b9\u306a\u624b\u6bb5\u3067\u3059\u3002\u5f15\u6570\u3068\u623b\u308a\u5024\u3092\u9069\u5207\u306b\u8a2d\u8a08\u3059\u308b\u3053\u3068\u3067\u3001\u4fdd\u5b88\u6027\u306e\u9ad8\u3044\u30b3\u30fc\u30c9\u304c\u5b9f\u73fe\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u95a2\u6570\u5b9a\u7fa9\u6642\u306f\u3001\u5f15\u6570\u306e\u6709\u7121\u3001\u623b\u308a\u5024\u306e\u578b\u3001\u30a8\u30e9\u30fc\u51e6\u7406\u306e\u6709\u7121\u306a\u3069\u3092\u8003\u616e\u3057\u3001\u5b9f\u52d9\u306b\u5fdc\u3058\u305f\u4f7f\u3044\u5206\u3051\u304c\u6c42\u3081\u3089\u308c\u307e\u3059\u3002\u7279\u306b\u578b\u6307\u5b9a\u3084\u30b9\u30b3\u30fc\u30d7\u306b\u95a2\u3059\u308b\u4ed5\u69d8\u306b\u306f\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u672c\u8a18\u4e8b\u306e\u30dd\u30a4\u30f3\u30c8 2. PHP\u306e\u81ea\u4f5c\u95a2\u6570\u3068\u306f\uff1f PHP\u306b\u304a\u3051\u308b\u95a2\u6570\u306f\u3001\u4e00\u9023\u306e\u51e6\u7406\u3092\u307e\u3068\u3081\u3066\u518d\u5229\u7528\u53ef\u80fd\u306b\u3059\u308b\u305f\u3081\u306e\u4ed5\u7d44\u307f\u3067\u3059\u3002\u7d44\u307f\u8fbc\u307f\u95a2\u6570\u306b\u52a0\u3048\u3001\u958b\u767a\u8005\u304c\u72ec\u81ea\u306b\u5b9a\u7fa9\u3059\u308b\u300c\u30e6\u30fc\u30b6\u30fc\u5b9a\u7fa9\u95a2\u6570\uff08\u81ea\u4f5c\u95a2\u6570\uff09\u300d\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":623,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[85],"tags":[],"class_list":["post-763","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\/763","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=763"}],"version-history":[{"count":2,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/763\/revisions"}],"predecessor-version":[{"id":867,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/763\/revisions\/867"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/media\/623"}],"wp:attachment":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=763"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=763"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=763"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}