{"id":776,"date":"2025-08-04T16:13:09","date_gmt":"2025-08-04T07:13:09","guid":{"rendered":"https:\/\/nexive.tech\/?p=776"},"modified":"2025-08-04T16:13:10","modified_gmt":"2025-08-04T07:13:10","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-interface%e3%81%a8abstract%e3%82%af%e3%83%a9%e3%82%b9%e3%81%ae%e9%81%95%e3%81%84","status":"publish","type":"post","link":"https:\/\/nexive.tech\/?p=776","title":{"rendered":"\u3010\u30b5\u30af\u30c3\u3068\u89e3\u8aac\u3011PHP interface\u3068abstract\u30af\u30e9\u30b9\u306e\u9055\u3044"},"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>interface\u3068abstract\u30af\u30e9\u30b9\u306e\u8a2d\u8a08\u4e0a\u306e\u5f79\u5272\u3068\u4f7f\u3044\u5206\u3051\u3092\u89e3\u8aac<\/li>\n\n\n\n<li>PHP\u306e\u69cb\u6587\u30fb\u7d99\u627f\u5236\u7d04\u30fb\u5b9f\u88c5\u65b9\u6cd5\u306e\u9055\u3044\u3092\u5177\u4f53\u4f8b\u3067\u793a\u3059<\/li>\n\n\n\n<li>\u5b9f\u52d9\u306b\u304a\u3051\u308b\u9078\u5b9a\u5224\u65ad\u3084\u843d\u3068\u3057\u7a74\u3082\u30ab\u30d0\u30fc<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">2. PHP\u306einterface\u3068abstract\u30af\u30e9\u30b9\u306e\u9055\u3044\u3068\u306f\uff1f<\/h2>\n\n\n\n<p>PHP\u306b\u304a\u3051\u308b<code>interface<\/code>\u3068<code>abstract<\/code>\u30af\u30e9\u30b9\u306f\u3001\u3044\u305a\u308c\u3082\u5171\u901a\u306e\u632f\u308b\u821e\u3044\u3092\u5b9a\u7fa9\u3059\u308b\u624b\u6bb5\u3067\u3059\u304c\u3001\u8a2d\u8a08\u76ee\u7684\u3084\u4f7f\u3044\u65b9\u306b\u660e\u78ba\u306a\u9055\u3044\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p><code>interface<\/code>\u306f\u3001\u5b9f\u88c5\u3059\u3079\u304d\u30e1\u30bd\u30c3\u30c9\u306e\u30b7\u30b0\u30cd\u30c1\u30e3\u306e\u307f\u3092\u5b9a\u7fa9\u3057\u3001\u51e6\u7406\u5185\u5bb9\uff08\u4e2d\u8eab\uff09\u306f\u6301\u3061\u307e\u305b\u3093\u3002\u591a\u91cd\u7d99\u627f\u304c\u53ef\u80fd\u3067\u3001\u7570\u306a\u308b\u30af\u30e9\u30b9\u9593\u306b\u5171\u901a\u306e\u5951\u7d04\uff08\u4ed5\u69d8\uff09\u3092\u6301\u305f\u305b\u308b\u3053\u3068\u304c\u4e3b\u76ee\u7684\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u4e00\u65b9\u3001<code>abstract<\/code>\u30af\u30e9\u30b9\u306f\u3001\u672a\u5b9f\u88c5\u306e\u62bd\u8c61\u30e1\u30bd\u30c3\u30c9\u3068\u3001\u5b9f\u88c5\u6e08\u307f\u306e\u5177\u4f53\u30e1\u30bd\u30c3\u30c9\u3084\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u6df7\u5728\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u7d99\u627f\u5148\u30af\u30e9\u30b9\u306b\u57fa\u672c\u7684\u306a\u632f\u308b\u821e\u3044\u3092\u63d0\u4f9b\u3057\u3064\u3064\u3001\u7279\u5b9a\u306e\u632f\u308b\u821e\u3044\u3060\u3051\u3092\u30b5\u30d6\u30af\u30e9\u30b9\u306b\u59d4\u306d\u308b\u969b\u306b\u4f7f\u308f\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u5b9f\u52d9\u3067\u306f\u3001\u5916\u90e8\u9023\u643a\u30fb\u30d7\u30e9\u30b0\u30a4\u30f3\u62e1\u5f35\u30fb\u5951\u7d04\u5b9a\u7fa9\u306b\u306f<code>interface<\/code>\u3001\u5171\u901a\u5b9f\u88c5\u306e\u7d99\u627f\u3084\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30e1\u30bd\u30c3\u30c9\u30d1\u30bf\u30fc\u30f3\u306b\u306f<code>abstract<\/code>\u30af\u30e9\u30b9\u304c\u9078\u3070\u308c\u308b\u50be\u5411\u304c\u3042\u308a\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\">1. \u8907\u6570\u306e\u30af\u30e9\u30b9\u306b\u5171\u901a\u306e\u6a5f\u80fd\u4ed5\u69d8\u3092\u6301\u305f\u305b\u305f\u3044\u5834\u5408\uff08interface\uff09<\/h3>\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>interface Logger {\n    public function log(string $message): void;\n}\n\nclass FileLogger implements Logger {\n    public function log(string $message): void {\n        \/\/ \u30ed\u30b0\u3092\u30d5\u30a1\u30a4\u30eb\u306b\u51fa\u529b\n        echo \"File: $message\\n\";\n    }\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: #569CD6\">interface<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Logger<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">public<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">function<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">log<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #569CD6\">string<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$message<\/span><span style=\"color: #D4D4D4\">): <\/span><span style=\"color: #569CD6\">void<\/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: #569CD6\">class<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">FileLogger<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">implements<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Logger<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">public<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">function<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">log<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #569CD6\">string<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$message<\/span><span style=\"color: #D4D4D4\">): <\/span><span style=\"color: #569CD6\">void<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #6A9955\">\/\/ \u30ed\u30b0\u3092\u30d5\u30a1\u30a4\u30eb\u306b\u51fa\u529b<\/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;File: <\/span><span style=\"color: #9CDCFE\">$message<\/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: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306b\u3001interface\u306f\u5fc5\u305a\u3059\u3079\u3066\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u5b9f\u88c5\u3057\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002<br>\u8907\u6570\u306einterface\u3092\u540c\u6642\u306b\u5b9f\u88c5\u3067\u304d\u308b\u305f\u3081\u3001\u7570\u306a\u308b\u95a2\u5fc3\u3054\u3068\u3092\u5206\u96e2\u3057\u3066\u8a2d\u8a08\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. \u57fa\u5e95\u30af\u30e9\u30b9\u3068\u3057\u3066\u5171\u901a\u51e6\u7406\u3092\u6301\u305f\u305b\u305f\u3044\u5834\u5408\uff08abstract\u30af\u30e9\u30b9\uff09<\/h3>\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>abstract class BaseLogger {\n    protected string $prefix = '&#91;LOG&#93;';\n\n    abstract public function log(string $message): void;\n\n    public function format(string $message): string {\n        return $this->prefix . ' ' . $message;\n    }\n}\n\nclass ConsoleLogger extends BaseLogger {\n    public function log(string $message): void {\n        echo $this->format($message) . \"\\n\";\n    }\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: #569CD6\">abstract<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">class<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">BaseLogger<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">protected<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">string<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$prefix<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #CE9178\">&#39;&#91;LOG&#93;&#39;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">abstract<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">public<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">function<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">log<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #569CD6\">string<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$message<\/span><span style=\"color: #D4D4D4\">): <\/span><span style=\"color: #569CD6\">void<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">public<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">function<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">format<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #569CD6\">string<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$message<\/span><span style=\"color: #D4D4D4\">): <\/span><span style=\"color: #569CD6\">string<\/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: #569CD6\">$this<\/span><span style=\"color: #D4D4D4\">-&gt;<\/span><span style=\"color: #9CDCFE\">prefix<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&#39; &#39;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$message<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><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: #569CD6\">class<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">ConsoleLogger<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">extends<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">BaseLogger<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">public<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">function<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">log<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #569CD6\">string<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$message<\/span><span style=\"color: #D4D4D4\">): <\/span><span style=\"color: #569CD6\">void<\/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: #569CD6\">$this<\/span><span style=\"color: #D4D4D4\">-&gt;<\/span><span style=\"color: #DCDCAA\">format<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$message<\/span><span style=\"color: #D4D4D4\">) <\/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: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>abstract\u30af\u30e9\u30b9\u3067\u306f\u3001\u4e00\u90e8\u3092\u5177\u4f53\u7684\u306b\u5b9a\u7fa9\u3057\u3066\u304a\u304d\u3001\u5171\u901a\u51e6\u7406\u306e\u91cd\u8907\u3092\u907f\u3051\u3089\u308c\u307e\u3059\u3002<br><code>format()<\/code>\u306e\u3088\u3046\u306a\u5171\u901a\u30e1\u30bd\u30c3\u30c9\u3092\u7d99\u627f\u5148\u3067\u305d\u306e\u307e\u307e\u4f7f\u3048\u308b\u306e\u304c\u5229\u70b9\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. interface\u3068abstract\u306e\u9055\u3044\u307e\u3068\u3081<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u6bd4\u8f03\u9805\u76ee<\/th><th>interface<\/th><th>abstract\u30af\u30e9\u30b9<\/th><\/tr><\/thead><tbody><tr><td>\u591a\u91cd\u7d99\u627f<\/td><td>\u53ef\u80fd<\/td><td>\u4e0d\u53ef<\/td><\/tr><tr><td>\u5b9f\u88c5\u6e08\u307f\u30e1\u30bd\u30c3\u30c9<\/td><td>\u4e0d\u53ef<\/td><td>\u53ef\u80fd<\/td><\/tr><tr><td>\u30d7\u30ed\u30d1\u30c6\u30a3\u5b9a\u7fa9<\/td><td>\u4e0d\u53ef<\/td><td>\u53ef\u80fd<\/td><\/tr><tr><td>\u5b9f\u88c5\u5fc5\u9808<\/td><td>\u3059\u3079\u3066\u306e\u30e1\u30bd\u30c3\u30c9<\/td><td>\u62bd\u8c61\u30e1\u30bd\u30c3\u30c9\u306e\u307f<\/td><\/tr><tr><td>\u7528\u9014<\/td><td>\u5951\u7d04\u30fb\u4ed5\u69d8\u306e\u660e\u793a<\/td><td>\u90e8\u5206\u5b9f\u88c5\uff0b\u7d99\u627f\u306e\u518d\u5229\u7528<\/td><\/tr><\/tbody><\/table><\/figure>\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><code>interface<\/code>\u306b\u306f<strong>\u30d7\u30ed\u30d1\u30c6\u30a3\u3084\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3092\u5b9a\u7fa9\u3067\u304d\u306a\u3044<\/strong>\u305f\u3081\u3001\u72b6\u614b\u3092\u6301\u305f\u305b\u305f\u3044\u5834\u5408\u306b\u306f\u4e0d\u5411\u304d\u3067\u3059\u3002<\/li>\n\n\n\n<li><code>abstract<\/code>\u30af\u30e9\u30b9\u306f<strong>\u7d99\u627f\u5236\u7d04\u304c1\u3064\u306e\u307f<\/strong>\u3067\u3042\u308b\u305f\u3081\u3001\u591a\u91cd\u7d99\u627f\u3057\u305f\u3044\u5834\u5408\u306b\u306f\u4e0d\u9069\u3067\u3059\u3002<\/li>\n\n\n\n<li>interface\u306b\u65e2\u5b9a\u51e6\u7406\u3092\u5165\u308c\u3088\u3046\u3068\u3059\u308b\u8aa4\u7528\u3082\u898b\u3089\u308c\u307e\u3059\u304c\u3001\u3053\u308c\u306f\u4ed5\u69d8\u7684\u306b\u4e0d\u53ef\u80fd\u3067\u3059\uff08PHP 8.1\u4ee5\u964d\u3067<code>default methods<\/code>\u7684\u306a\u8a18\u8ff0\u306f\u4e0d\u53ef\uff09\u3002<\/li>\n\n\n\n<li>trait\u3068\u306e\u4f7f\u3044\u5206\u3051\u3082\u8aa4\u89e3\u3055\u308c\u304c\u3061\u3067\u3059\u304c\u3001trait\u306f\u30b3\u30fc\u30c9\u306e<strong>\u518d\u5229\u7528<\/strong>\u304c\u76ee\u7684\u3067\u3001interface\u3084abstract\u3068\u306f\u5f79\u5272\u304c\u7570\u306a\u308a\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">5. \u307e\u3068\u3081<\/h2>\n\n\n\n<p>PHP\u306b\u304a\u3044\u3066\u3001<code>interface<\/code>\u306f\u4ed5\u69d8\u5b9a\u7fa9\u3001<code>abstract<\/code>\u30af\u30e9\u30b9\u306f\u5171\u901a\u51e6\u7406\u306e\u90e8\u5206\u5b9f\u88c5\u306b\u7528\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u8907\u6570\u306e\u578b\u306b\u5171\u901a\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u5f37\u5236\u3057\u305f\u3044 \u2192 <code>interface<\/code><\/li>\n\n\n\n<li>\u4e00\u90e8\u5171\u901a\u30ed\u30b8\u30c3\u30af\u3092\u7d99\u627f\u3055\u305b\u305f\u3044 \u2192 <code>abstract class<\/code><\/li>\n<\/ul>\n\n\n\n<p>\u7d99\u627f\u5236\u7d04\u3084\u30e1\u30bd\u30c3\u30c9\u5b9f\u88c5\u306e\u6709\u7121\u3001\u8a2d\u8a08\u610f\u56f3\u3092\u8e0f\u307e\u3048\u3066\u9069\u5207\u306b\u4f7f\u3044\u5206\u3051\u307e\u3057\u3087\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u672c\u8a18\u4e8b\u306e\u30dd\u30a4\u30f3\u30c8 2. PHP\u306einterface\u3068abstract\u30af\u30e9\u30b9\u306e\u9055\u3044\u3068\u306f\uff1f PHP\u306b\u304a\u3051\u308binterface\u3068abstract\u30af\u30e9\u30b9\u306f\u3001\u3044\u305a\u308c\u3082\u5171\u901a\u306e\u632f\u308b\u821e\u3044\u3092\u5b9a\u7fa9\u3059\u308b\u624b\u6bb5\u3067\u3059\u304c\u3001\u8a2d\u8a08\u76ee\u7684\u3084\u4f7f\u3044\u65b9\u306b\u660e\u78ba [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":696,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[85],"tags":[],"class_list":["post-776","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\/776","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=776"}],"version-history":[{"count":2,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/776\/revisions"}],"predecessor-version":[{"id":872,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/776\/revisions\/872"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/media\/696"}],"wp:attachment":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=776"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}