{"id":759,"date":"2025-08-04T09:47:21","date_gmt":"2025-08-04T00:47:21","guid":{"rendered":"https:\/\/nexive.tech\/?p=759"},"modified":"2025-08-04T09:47:21","modified_gmt":"2025-08-04T00:47:21","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-null%e5%90%88%e4%bd%93%e6%bc%94%e7%ae%97%e5%ad%90%e3%81%a8%e4%b8%89%e9%a0%85%e6%bc%94%e7%ae%97%e5%ad%90%e3%81%ae%e4%bd%bf","status":"publish","type":"post","link":"https:\/\/nexive.tech\/?p=759","title":{"rendered":"\u3010\u30b5\u30af\u30c3\u3068\u89e3\u8aac\u3011PHP null\u5408\u4f53\u6f14\u7b97\u5b50\u3068\u4e09\u9805\u6f14\u7b97\u5b50\u306e\u4f7f\u3044\u5206\u3051"},"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\u306enull\u5408\u4f53\u6f14\u7b97\u5b50\uff08??\uff09\u3068\u4e09\u9805\u6f14\u7b97\u5b50\uff08?:\uff09\u306e\u9055\u3044\u3068\u4f7f\u3044\u5206\u3051\u3092\u89e3\u8aac<\/li>\n\n\n\n<li>\u5b9f\u884c\u53ef\u80fd\u306a\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3068\u51fa\u529b\u4ed8\u304d\u3067\u52d5\u4f5c\u3092\u660e\u793a<\/li>\n\n\n\n<li>\u5b9f\u52d9\u306b\u304a\u3051\u308b\u4f7f\u3044\u3069\u3053\u308d\u3084\u6ce8\u610f\u70b9\u3082\u4f75\u305b\u3066\u7d39\u4ecb<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">2. PHP\u306enull\u5408\u4f53\u6f14\u7b97\u5b50\u30fb\u4e09\u9805\u6f14\u7b97\u5b50\u3068\u306f\uff1f<\/h2>\n\n\n\n<p>PHP\u306b\u304a\u3051\u308bnull\u5408\u4f53\u6f14\u7b97\u5b50\uff08<code>??<\/code>\uff09\u3068\u4e09\u9805\u6f14\u7b97\u5b50\uff08<code>?:<\/code>\uff09\u306f\u3001\u3044\u305a\u308c\u3082\u300c\u6761\u4ef6\u306b\u5fdc\u3058\u305f\u5024\u306e\u9078\u629e\u300d\u306b\u4f7f\u308f\u308c\u308b\u69cb\u6587\u3067\u3059\u3002<\/p>\n\n\n\n<p>null\u5408\u4f53\u6f14\u7b97\u5b50\uff08<code>??<\/code>\uff09\u306f\u3001\u5de6\u5074\u306e\u5024\u304cnull\u3067\u3042\u308b\u304b\u3069\u3046\u304b\u3092\u8a55\u4fa1\u3057\u3001null\u3067\u3042\u308c\u3070\u53f3\u5074\u306e\u5024\u3092\u8fd4\u3057\u307e\u3059\u3002<br>\u4e3b\u306b\u300c\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306e\u8a2d\u5b9a\u300d\u3084\u300c\u672a\u5b9a\u7fa9\u5909\u6570\u306e\u4ee3\u66ff\u51e6\u7406\u300d\u3067\u5229\u7528\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u4e00\u65b9\u3001\u4e09\u9805\u6f14\u7b97\u5b50\uff08<code>?:<\/code>\uff09\u306f\u3001\u6761\u4ef6\u5f0f\u306e\u771f\u507d\u5024\u306b\u5fdc\u3058\u30662\u3064\u306e\u5024\u304b\u3089\u9078\u629e\u3059\u308b\u69cb\u6587\u3067\u3059\u3002<br>\u6761\u4ef6\u304ctrue\u3067\u3042\u308c\u3070\u524d\u8005\u3001false\u3067\u3042\u308c\u3070\u5f8c\u8005\u304c\u8fd4\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3044\u305a\u308c\u3082\u77ed\u304f\u7c21\u6f54\u306a\u8a18\u8ff0\u3092\u53ef\u80fd\u306b\u3059\u308b\u305f\u3081\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u51e6\u7406\u3084API\u30ec\u30b9\u30dd\u30f3\u30b9\u6574\u5f62\u306a\u3069\u5b9f\u52d9\u306e\u73fe\u5834\u3067\u983b\u7e41\u306b\u5229\u7528\u3055\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\">null\u5408\u4f53\u6f14\u7b97\u5b50\uff08??\uff09\u306e\u57fa\u672c\u69cb\u6587<\/h3>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3001\u5de6\u8fba\u304cnull\u3067\u3042\u308c\u3070\u53f3\u8fba\u3092\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>\/\/ \u30e6\u30fc\u30b6\u30fc\u304c\u5165\u529b\u3057\u305f\u5024\uff08\u306a\u3051\u308c\u3070\u30c7\u30d5\u30a9\u30eb\u30c8\uff09\u3092\u53d6\u5f97\u3059\u308b\n$input = $_GET&#91;'name'&#93; ?? '\u30b2\u30b9\u30c8';\necho $input; \/\/ \u4f8b: \u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u306a\u3051\u308c\u3070 \"\u30b2\u30b9\u30c8\"\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\">\/\/ \u30e6\u30fc\u30b6\u30fc\u304c\u5165\u529b\u3057\u305f\u5024\uff08\u306a\u3051\u308c\u3070\u30c7\u30d5\u30a9\u30eb\u30c8\uff09\u3092\u53d6\u5f97\u3059\u308b<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$input<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #9CDCFE\">$_GET<\/span><span style=\"color: #D4D4D4\">&#91;<\/span><span style=\"color: #CE9178\">&#39;name&#39;<\/span><span style=\"color: #D4D4D4\">&#93; ?? <\/span><span style=\"color: #CE9178\">&#39;\u30b2\u30b9\u30c8&#39;<\/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\">$input<\/span><span style=\"color: #D4D4D4\">; <\/span><span style=\"color: #6A9955\">\/\/ \u4f8b: \u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u306a\u3051\u308c\u3070 &quot;\u30b2\u30b9\u30c8&quot;<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u3053\u306e\u6f14\u7b97\u5b50\u306f\u3001\u5909\u6570\u304c\u672a\u5b9a\u7fa9\u307e\u305f\u306fnull\u306e\u5834\u5408\u306b\u5099\u3048\u3066\u5024\u3092\u8a2d\u5b9a\u3059\u308b\u5178\u578b\u4f8b\u3067\u3059\u3002<br>isset()\u3092\u4f7f\u3063\u305f\u8a18\u8ff0\u3088\u308a\u7c21\u6f54\u304b\u3064\u53ef\u8aad\u6027\u304c\u9ad8\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u4e09\u9805\u6f14\u7b97\u5b50\uff08?:\uff09\u306e\u57fa\u672c\u69cb\u6587<\/h3>\n\n\n\n<p>\u6761\u4ef6\u5f0f\u304ctrue\u304bfalse\u304b\u306b\u5fdc\u3058\u3066\u8fd4\u3059\u5024\u3092\u9078\u629e\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>\/\/ \u5e74\u9f62\u306b\u3088\u3063\u3066\u30e9\u30d9\u30eb\u3092\u6c7a\u3081\u308b\n$label = ($age >= 20) ? '\u6210\u4eba' : '\u672a\u6210\u5e74';\necho $label; \/\/ \u4f8b: \u5e74\u9f62\u304c18\u306a\u3089 \"\u672a\u6210\u5e74\"\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\">\/\/ \u5e74\u9f62\u306b\u3088\u3063\u3066\u30e9\u30d9\u30eb\u3092\u6c7a\u3081\u308b<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$label<\/span><span style=\"color: #D4D4D4\"> = (<\/span><span style=\"color: #9CDCFE\">$age<\/span><span style=\"color: #D4D4D4\"> &gt;= <\/span><span style=\"color: #B5CEA8\">20<\/span><span style=\"color: #D4D4D4\">) ? <\/span><span style=\"color: #CE9178\">&#39;\u6210\u4eba&#39;<\/span><span style=\"color: #D4D4D4\"> : <\/span><span style=\"color: #CE9178\">&#39;\u672a\u6210\u5e74&#39;<\/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\">$label<\/span><span style=\"color: #D4D4D4\">; <\/span><span style=\"color: #6A9955\">\/\/ \u4f8b: \u5e74\u9f62\u304c18\u306a\u3089 &quot;\u672a\u6210\u5e74&quot;<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u4e09\u9805\u6f14\u7b97\u5b50\u306f\u3001\u6761\u4ef6\u5206\u5c90\u304c1\u884c\u3067\u53ce\u307e\u308b\u305f\u3081\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u51fa\u529b\u306a\u3069\u3067\u91cd\u5b9d\u3055\u308c\u307e\u3059\u3002<br>\u305f\u3060\u3057\u3001\u6761\u4ef6\u5f0f\u304c\u8907\u96d1\u306a\u5834\u5408\u306f\u8aad\u307f\u3065\u3089\u304f\u306a\u308b\u305f\u3081\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7c21\u6613\u4e09\u9805\u6f14\u7b97\u5b50\uff08\u7701\u7565\u5f62\uff09\u3068\u306e\u9055\u3044<\/h3>\n\n\n\n<p>PHP\u3067\u306f\u5de6\u8fba\u3092\u8a55\u4fa1\u3057\u3066\u305d\u306e\u307e\u307e\u8fd4\u3059\u300c\u7701\u7565\u5f62\u300d\u3082\u5b58\u5728\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>$value = $title ?: '\u30c7\u30d5\u30a9\u30eb\u30c8\u30bf\u30a4\u30c8\u30eb';\necho $value;\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\">$value<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #9CDCFE\">$title<\/span><span style=\"color: #D4D4D4\"> ?: <\/span><span style=\"color: #CE9178\">&#39;\u30c7\u30d5\u30a9\u30eb\u30c8\u30bf\u30a4\u30c8\u30eb&#39;<\/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\">$value<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u3053\u306e\u69cb\u6587\u306f\u3001$title\u304cfalsy\u306a\u5024\uff08null\u3001\u7a7a\u6587\u5b57\u30010\u306a\u3069\uff09\u306e\u5834\u5408\u306b\u53f3\u8fba\u3092\u8fd4\u3057\u307e\u3059\u3002<br>null\u5408\u4f53\u6f14\u7b97\u5b50\uff08<code>??<\/code>\uff09\u3068\u306e\u9055\u3044\u306f\u3001null\u4ee5\u5916\u306efalsy\u3082\u5bfe\u8c61\u306b\u542b\u307e\u308c\u308b\u70b9\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">null\u5408\u4f53\u6f14\u7b97\u5b50\u3068\u4e09\u9805\u6f14\u7b97\u5b50\u306e\u9078\u5b9a\u57fa\u6e96<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&#8220;null\u304b\u3069\u3046\u304b&#8221; \u3092\u5224\u5b9a\u3057\u305f\u3044 \u2192 <code>??<\/code><\/li>\n\n\n\n<li>&#8220;\u6761\u4ef6\u5f0f\u304ctrue\/false\u304b&#8221; \u3067\u9078\u3073\u305f\u3044 \u2192 <code>?:<\/code><\/li>\n\n\n\n<li>&#8220;falsy\u5024\u3082\u8003\u616e\u3057\u305f\u3044&#8221; \u2192 \u7c21\u6613\u4e09\u9805\u6f14\u7b97\u5b50<\/li>\n<\/ul>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u9078\u5b9a\u3092\u660e\u78ba\u306b\u3057\u306a\u3044\u3068\u3001\u610f\u56f3\u3057\u306a\u3044\u6319\u52d5\u3084\u30d0\u30b0\u3092\u5f15\u304d\u8d77\u3053\u3059\u539f\u56e0\u306b\u306a\u308a\u307e\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<p>null\u5408\u4f53\u6f14\u7b97\u5b50\u306f&#8221;null\u304b\u3069\u3046\u304b&#8221;\u3057\u304b\u898b\u307e\u305b\u3093\u3002\u7a7a\u6587\u5b57\u3084false\u30010\u306fnull\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u610f\u56f3\u901a\u308a\u306b\u52d5\u304b\u306a\u3044\u3053\u3068\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>$value = \"\" ?? \"\u521d\u671f\u5024\";  \/\/ \u7d50\u679c: \u7a7a\u6587\u5b57\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\">$value<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #CE9178\">&quot;&quot;<\/span><span style=\"color: #D4D4D4\"> ?? <\/span><span style=\"color: #CE9178\">&quot;\u521d\u671f\u5024&quot;<\/span><span style=\"color: #D4D4D4\">;  <\/span><span style=\"color: #6A9955\">\/\/ \u7d50\u679c: \u7a7a\u6587\u5b57<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u3053\u306e\u5834\u5408\u3001\u7a7a\u6587\u5b57\u306fnull\u3067\u306f\u306a\u3044\u306e\u3067\u305d\u306e\u307e\u307e\u8fd4\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u307e\u305f\u3001\u4e09\u9805\u6f14\u7b97\u5b50\u3092\u591a\u91cd\u306b\u30cd\u30b9\u30c8\u3059\u308b\u3068\u53ef\u8aad\u6027\u304c\u8457\u3057\u304f\u4e0b\u304c\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>\/\/ \u53ef\u8aad\u6027\u304c\u4f4e\u304f\u306a\u308b\u4f8b\n$label = $x ? ($y ? 'A' : 'B') : ($z ? 'C' : 'D');\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\">\/\/ \u53ef\u8aad\u6027\u304c\u4f4e\u304f\u306a\u308b\u4f8b<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$label<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #9CDCFE\">$x<\/span><span style=\"color: #D4D4D4\"> ? (<\/span><span style=\"color: #9CDCFE\">$y<\/span><span style=\"color: #D4D4D4\"> ? <\/span><span style=\"color: #CE9178\">&#39;A&#39;<\/span><span style=\"color: #D4D4D4\"> : <\/span><span style=\"color: #CE9178\">&#39;B&#39;<\/span><span style=\"color: #D4D4D4\">) : (<\/span><span style=\"color: #9CDCFE\">$z<\/span><span style=\"color: #D4D4D4\"> ? <\/span><span style=\"color: #CE9178\">&#39;C&#39;<\/span><span style=\"color: #D4D4D4\"> : <\/span><span style=\"color: #CE9178\">&#39;D&#39;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306a\u5834\u5408\u306f\u3001if-else\u6587\u306b\u5206\u89e3\u3059\u308b\u307b\u3046\u304c\u4fdd\u5b88\u6027\u306b\u512a\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u6700\u5f8c\u306b\u3001<code>??<\/code>\u3068<code>?:<\/code>\u306fPHP 7\u4ee5\u964d\u3067\u4f7f\u3048\u308b\u69cb\u6587\u3067\u3042\u308b\u305f\u3081\u3001PHP 5\u7cfb\u3067\u306f\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093\u3002<br>\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u3088\u3063\u3066\u306f\u69cb\u6587\u30a8\u30e9\u30fc\u3068\u306a\u308b\u70b9\u306b\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5. \u307e\u3068\u3081<\/h2>\n\n\n\n<p>PHP\u306enull\u5408\u4f53\u6f14\u7b97\u5b50\uff08<code>??<\/code>\uff09\u3068\u4e09\u9805\u6f14\u7b97\u5b50\uff08<code>?:<\/code>\uff09\u306f\u3001\u6761\u4ef6\u306b\u5fdc\u3058\u305f\u5024\u306e\u9078\u629e\u306b\u4fbf\u5229\u306a\u69cb\u6587\u3067\u3059\u3002<br>null\u3060\u3051\u3092\u5bfe\u8c61\u306b\u3059\u308b<code>??<\/code>\u3001\u771f\u507d\u5024\u3092\u5224\u5b9a\u3059\u308b<code>?:<\/code>\u3001falsy\u5168\u822c\u3092\u5bfe\u8c61\u3068\u3059\u308b\u7701\u7565\u5f62\u3068\u3001\u7528\u9014\u306b\u5fdc\u3058\u3066\u6b63\u3057\u304f\u4f7f\u3044\u5206\u3051\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u30d0\u30fc\u30b8\u30e7\u30f3\u4e92\u63db\u6027\u3084\u53ef\u8aad\u6027\u3078\u306e\u914d\u616e\u3082\u542b\u3081\u3001\u5834\u9762\u306b\u5fdc\u3058\u3066\u67d4\u8edf\u306b\u9078\u5b9a\u3059\u308b\u8a2d\u8a08\u5224\u65ad\u304c\u6c42\u3081\u3089\u308c\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u672c\u8a18\u4e8b\u306e\u30dd\u30a4\u30f3\u30c8 2. PHP\u306enull\u5408\u4f53\u6f14\u7b97\u5b50\u30fb\u4e09\u9805\u6f14\u7b97\u5b50\u3068\u306f\uff1f PHP\u306b\u304a\u3051\u308bnull\u5408\u4f53\u6f14\u7b97\u5b50\uff08??\uff09\u3068\u4e09\u9805\u6f14\u7b97\u5b50\uff08?:\uff09\u306f\u3001\u3044\u305a\u308c\u3082\u300c\u6761\u4ef6\u306b\u5fdc\u3058\u305f\u5024\u306e\u9078\u629e\u300d\u306b\u4f7f\u308f\u308c\u308b\u69cb\u6587\u3067\u3059\u3002 null\u5408\u4f53\u6f14\u7b97\u5b50\uff08??\uff09 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":567,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[85],"tags":[],"class_list":["post-759","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\/759","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=759"}],"version-history":[{"count":2,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/759\/revisions"}],"predecessor-version":[{"id":772,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/759\/revisions\/772"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/media\/567"}],"wp:attachment":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=759"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=759"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=759"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}