{"id":1400,"date":"2017-03-14T23:55:17","date_gmt":"2017-03-14T14:55:17","guid":{"rendered":"http:\/\/www.sriproot.net\/blog\/?p=1400"},"modified":"2017-03-15T00:13:59","modified_gmt":"2017-03-14T15:13:59","slug":"0-determined-not-by-empty-but-by-isset","status":"publish","type":"post","link":"https:\/\/www.sriproot.net\/blog\/0-determined-not-by-empty-but-by-isset-1400","title":{"rendered":"0\u306fempty\u3058\u3083\u306a\u304f\u3066isset\u3067\u5224\u5b9a\u3059\u308b"},"content":{"rendered":"<p>\u3046\u3061\u306e\u5b50\u306f\u5c11\u5e74\u91ce\u7403\u3092\u3084\u3063\u3066\u3044\u3066\u30016\u5e74\u751f\u304c\u5f15\u9000\u3057\u3066\u3001\u3064\u3044\u5148\u65e5\u304b\u3089\u65b0\u30c1\u30fc\u30e0\u3068\u3057\u3066\u52d5\u304d\u59cb\u3081\u307e\u3057\u305f\u3002<br \/>\n\u3053\u308c\u304b\u3089\u30b7\u30fc\u30ba\u30f3\u30aa\u30d5\u307e\u3067\u3001\u6c17\u3065\u3051\u3070\u571f\u65e5\u304c\u7d42\u308f\u3063\u3066\u308b\u2026\u3002\u305d\u3093\u306a\u9031\u672b\u304c\u7d9a\u304d\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u5c11\u5e74\u91ce\u7403\u30c1\u30fc\u30e0\u306e\u30aa\u30d5\u30a3\u30b7\u30e3\u30eb\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u3068\u306f\u5225\u306b\u3001\u8a66\u5408\u306b\u6765\u3089\u308c\u306a\u3044\u89aa\u5fa1\u3055\u3093\u306b\u8a66\u5408\u306e\u69d8\u5b50\u3092\u4f1d\u3048\u3089\u308c\u305f\u3089\u3044\u3044\u306a\u3068\u601d\u3063\u3066\u3001\u5199\u771f\u30e1\u30a4\u30f3\u306e\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u3092\u50d5\u304c\u52dd\u624b\u306b\u4f5c\u3063\u305f\u3093\u3067\u3059\u3002<\/p>\n<p>\u305d\u306e\u4e2d\u306b\u30b9\u30b3\u30a2\u30dc\u30fc\u30c9\u306e\u5165\u529b\u3001\u8868\u793a\u3059\u308b\u90e8\u5206\u3092\u4f5c\u3063\u305f\u3093\u3067\u3059\u304c\u3001\u3046\u307e\u304f\u8868\u793a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u305a\u306b\u60a9\u3093\u3067\u3057\u307e\u3044\u307e\u3057\u305f\u3002<\/p>\n<p><!--more--><\/p>\n<h2>\u76ee\u6b21<\/h2>\n<ol>\n<li><a href=\"#step1\">\u4f5c\u3063\u305f\u3082\u306e\u306e\u6982\u8981<\/a><\/li>\n<li><a href=\"#step2\">0\u306e\u5224\u5b9a\u306fisset<\/a><\/li>\n<li><a href=\"#step3\">\u307e\u3068\u3081<\/a><\/li>\n<\/ol>\n<h2 id=\"step1\">\u4f5c\u3063\u305f\u3082\u306e\u306e\u6982\u8981<\/h2>\n<p>\u7ba1\u7406\u753b\u9762\u306b\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u3067\u3001\u30c1\u30fc\u30e0\u540d\u30687\u56de\u307e\u3067\u306e\u5165\u529b\u6b04\u3092\u4f5c\u3063\u3066\u3042\u3052\u3066\u3001\u305d\u3053\u306b\u5165\u529b\u3057\u305f\u3082\u306e\u3092\u3001\u8868\u306b\u8868\u793a\u3059\u308b\u3002\u305f\u3060\u305d\u308c\u3060\u3051\u3002<br \/>\n\u7c21\u5358\u3067\u3059\u3088\u306d\uff1f<\/p>\n<div class=\"figure\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.sriproot.net\/blog\/wp\/wp-content\/uploads\/2017\/03\/empty-0-isset001.png\" alt=\"\" width=\"652\" height=\"375\" class=\"aligncenter size-full wp-image-1401\" \/><\/div>\n<p>\u50d5\u3082\u7c21\u5358\u3060\u3068\u601d\u3063\u3066\u307e\u3057\u305f\u3002<\/p>\n<p>\u305f\u3060\u3001\u66f8\u3044\u3066\u307f\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u306f\u3001\u30c1\u30fc\u30e0\u540d\u306f\u306a\u3093\u306a\u304f\u8868\u793a\u3055\u308c\u305f\u3093\u3067\u3059\u304c\u3001\u30b9\u30b3\u30a2\u304c\u8868\u793a\u3055\u308c\u306a\u3044\u3002<br \/>\n\u3044\u3084\u3002\u51fa\u308b\u306b\u306f\u51fa\u308b\u3093\u3060\u3051\u3069\u3001\u70b9\u304c\u5165\u3063\u305f\u6642\u3057\u304b\u51fa\u306a\u3044\u3002<\/p>\n<div class=\"figure\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.sriproot.net\/blog\/wp\/wp-content\/uploads\/2017\/03\/empty-0-isset002.png\" alt=\"\" width=\"652\" height=\"375\" class=\"aligncenter size-full wp-image-1403\" \/><\/div>\n<p>\u304b\u306a\u308a\u60a9\u307f\u307e\u3057\u305f\u3002<\/p>\n<h2 id=\"step1\">0\u306f\u5b58\u5728\u3059\u308b\uff1f\u3057\u306a\u3044\uff1f<\/h2>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u307f\u308b\u3068\u3001\u5024\u306f\u5165\u3063\u3066\u308b\u306e\u304c\u78ba\u8a8d\u3067\u304d\u305f\u306e\u3067\u3001\u8868\u793a\u90e8\u5206\u304c\u304a\u304b\u3057\u3044\u3053\u3068\u306f\u78ba\u5b9f\u3002<\/p>\n<p>\u3067\u306f\u3001\u305d\u306e\u8868\u793a\u7528\u3059\u308b\u305f\u3081\u306e\u30b3\u30fc\u30c9\u306f\u3068\u3044\u3046\u3068\u3002<\/p>\n<p>[php]<br \/>\n$omote = array();<br \/>\n$ura = array();<br \/>\nfor($i=0; $i&lt;8; $i++) {<br \/>\n    \/\/\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9<br \/>\n    $get_field_omote = &#8216;scorebord_omote&#8217;.$i;<br \/>\n    $get_field_ura = &#8216;scorebord_ura&#8217;.$i;<br \/>\n    $get_field_omote_val = get_post_meta($id,$get_field_omote,true);<br \/>\n    $get_field_ura_val = get_post_meta($id,$get_field_ura,true);<br \/>\n    if(!empty($get_field_omote_val)) {<br \/>\n        $omote[] = $get_field_omote_val;<br \/>\n    }<br \/>\n    if(!empty($get_field_ura_val)) {<br \/>\n        $ura[] = $get_field_ura_val;<br \/>\n    }<br \/>\n}<br \/>\n[\/php]<\/p>\n<p>\u3053\u308c\u3067\u3059\u3002<br \/>\n\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u306f\u9023\u756a\u304c\u3075\u3063\u3066\u3042\u308b\u306e\u3067\u3001for\u6587\u3067\u30eb\u30fc\u30d7\u3055\u305b\u3066\u3001\u914d\u5217\u306b\u5165\u308c\u3066\u304a\u3044\u3066\u3001\u8868\u793a\u3055\u305b\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u306f\u5165\u3063\u3066\u305f\u306e\u3067\u3001\u3053\u306e\u914d\u5217\u3092\u30c0\u30f3\u30d7\u3057\u3066\u307f\u308b\u3068\u3001<\/p>\n<div class=\"figure\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.sriproot.net\/blog\/wp\/wp-content\/uploads\/2017\/03\/empty-0-isset003.png\" alt=\"\" width=\"639\" height=\"453\" class=\"aligncenter size-full wp-image-1402\" \/><\/div>\n<p>\u3042\u308c\uff1f0\u304c\u5165\u3063\u3066\u306a\u3044\u3002<br \/>\n\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b0\u304c\u5b58\u5728\u3057\u3066\u308b\u3051\u3069\u3001\u914d\u5217\u306b\u306f\u5b58\u5728\u3057\u3066\u3044\u306a\u3044\u3002<\/p>\n<p>\u8868\u306b\u3067\u3066\u306a\u3044\u304b\u3089\u3001\u914d\u5217\u306b\u5b58\u5728\u3057\u3066\u306a\u3044\u306e\u306f\u3042\u305f\u308a\u307e\u3048\u306a\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u3053\u306e\u3068\u304d\u306f\u4f55\u304c\u9593\u9055\u3044\u306a\u306e\u304b\u308f\u304b\u3089\u306a\u304f\u3066\u3002<br \/>\n\u914d\u5217\u3063\u30660\u30c0\u30e1\u306a\u306e\u304b\u306a\u3068\u601d\u3063\u3066\u3001string\u306b\u3057\u3066\u307f\u305f\u308a\u3057\u3066\u307e\u3057\u305f\u3002<\/p>\n<h2 id=\"step3\">0\u306e\u5224\u5b9a\u306fisset<\/h2>\n<p>\u5b9f\u306f\u914d\u5217\u306b\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u5024\u3092\u8ffd\u52a0\u3059\u308b\u969b\u306e\u5224\u5b9a\u304c\u304a\u304b\u3057\u304b\u3063\u305f\u3093\u3067\u3059\u3002<\/p>\n<p>[php]<br \/>\n    if(!empty($get_field_omote_val)) {<br \/>\n        $omote[] = $get_field_omote_val;<br \/>\n    }<br \/>\n[\/php]<\/p>\n<p>\u3053\u306e\u90e8\u5206\u3002\uff08\u88cf\u3082\u540c\u3058\uff09<\/p>\n<p>!empty\u3067\u300c\u304b\u3089\u3063\u307d\u3058\u3083\u306a\u304b\u3063\u305f\u3089\u300d\u3092\u5224\u5b9a\u3057\u3066\u3044\u305f\u3093\u3067\u3059\u304c\u3001!empty\u3067\u306f\u300c0\u300d\u3092\u300c\u304b\u3089\u3063\u307d\u300d\u3068\u3057\u3066\u6271\u3063\u3066\u3057\u307e\u3046\u3093\u3067\u3059\u3002<br \/>\n<a href=\"http:\/\/php.net\/manual\/ja\/function.empty.php#refsect1-function.empty-returnvalues\" target=\"_blank\">PHP: empty &#8211; Manual<\/a><\/p>\n<p>\u306a\u306e\u3067\u3001\u3053\u306e\u6761\u4ef6\u3067\u306f\u30b9\u30b3\u30a2\u304c0\u70b9\u3060\u3063\u305f\u5834\u5408\u306b\u3001\u914d\u5217\u306b\u8ffd\u52a0\u3055\u308c\u306a\u3044\u306e\u3067\u8868\u793a\u3055\u308c\u306a\u3044\u3002\u3068\u3044\u3046\u3053\u3068\u3060\u3063\u305f\u308f\u3051\u3067\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u300c0\u300d\u3092\u300c0\u300d\u3068\u3057\u3066\u5224\u5b9a\u3057\u3066\u304f\u308c\u308b\u3082\u306e\u3001\u305d\u308c\u306f\u300cisset\u300d\u3092\u4f7f\u3046\u3068\u53ef\u80fd\u3067\u3057\u305f\u3002<br \/>\n<a href=\"http:\/\/php.net\/manual\/ja\/function.isset.php\" target=\"_blank\">PHP: isset &#8211; Manual<\/a><\/p>\n<p>\u300cisset\u300d\u306f\u5909\u6570\u306b\u4f55\u304b\u3057\u3089\u30bb\u30c3\u30c8\u3055\u308c\u3066\u308c\u3070\u3001true\u3092\u8fd4\u3057\u3066\u304f\u308c\u308b\u3060\u305d\u3046\u3067\u3002<br \/>\n\u5148\u7a0b\u306e\u30b3\u30fc\u30c9\u3092<br \/>\n[php]<br \/>\n    if(isset($get_field_omote_val)) {<br \/>\n        $omote[] = $get_field_omote_val;<br \/>\n    }<br \/>\n[\/php]<\/p>\n<p>\u3053\u3046\u3084\u3063\u3066\u66f8\u304d\u63db\u3048\u307e\u3059\u3002<br \/>\n\u3044\u3084\u3041\u3001\u539f\u56e0\u304c\u308f\u304b\u3063\u3066\u3088\u304b\u3063\u305f\u3002<\/p>\n<p>\u305d\u3053\u3067\u8a72\u5f53\u7b87\u6240\u3092\u300c!empty\u300d\u304b\u3089\u300cisset\u300d\u306b\u5909\u66f4\u3057\u305f\u3089<\/p>\n<div class=\"figure\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.sriproot.net\/blog\/wp\/wp-content\/uploads\/2017\/03\/empty-0-isset004.png\" alt=\"\" width=\"652\" height=\"375\" class=\"aligncenter size-full wp-image-1404\" \/><\/div>\n<p>\u30d0\u30c3\u30c1\u30ea\u8868\u793a\u3055\u308c\u307e\u3057\u305f\uff01<\/p>\n<h2 id=\"step4\">\u307e\u3068\u3081<\/h2>\n<p>\u305d\u3082\u305d\u3082\u5909\u6570\u304c\u304b\u3089\u3063\u307d\u304b\u3069\u3046\u304b\u3092\u300c!empty\u300d\u3067\u305a\u30fc\u3063\u3068\u5224\u5b9a\u3057\u7d9a\u3051\u3066\u3044\u305f\u306e\u3067\u3001\u3053\u3093\u306a\u4e8b\u306b\u30cf\u30de\u3063\u3066\u3057\u307e\u3063\u3066\u2026\u3002<br \/>\nempty\u3084isset\u307f\u305f\u3044\u306b\u3001\u4f3c\u3066\u308b\u3051\u3069\u4f7f\u3044\u6240\u304c\u9055\u3063\u305f\u308a\u3001\u6271\u3046\u3068\u3053\u308d\u304c\u9055\u3063\u305f\u308a\u3001\u3068\u3044\u3046\u95a2\u6570\u3092\u60f0\u6027\u3067\u306f\u306a\u304f\u3066\u3082\u3063\u3068\u7406\u89e3\u6df1\u3081\u3066\u3044\u304f\u5fc5\u8981\u304c\u3042\u308a\u305d\u3046\u3060\u306a\u3041\u2026\u3002<\/p>\n<p>\u307e\u305f\u3053\u3093\u306a\u3068\u3053\u308d\u3067\u8e93\u304b\u306a\u3044\u3088\u3046\u306b\u3001\u3053\u3046\u3084\u3063\u3066\u30e1\u30e2\u3059\u308b\u3068\u3053\u308d\u304b\u3089\u3001\u4e00\u6b69\u305a\u3064\u2026\u3002<\/p>\n<p>\u305d\u3044\u304e\uff5e<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3046\u3061\u306e\u5b50\u306f\u5c11\u5e74\u91ce\u7403\u3092\u3084\u3063\u3066\u3044\u3066\u30016\u5e74\u751f\u304c\u5f15\u9000\u3057\u3066\u3001\u3064\u3044\u5148\u65e5\u304b\u3089\u65b0\u30c1\u30fc\u30e0\u3068\u3057\u3066\u52d5\u304d&#8230;<\/p>\n","protected":false},"author":2,"featured_media":1405,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[223],"tags":[116],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/posts\/1400"}],"collection":[{"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/comments?post=1400"}],"version-history":[{"count":0,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/posts\/1400\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/media\/1405"}],"wp:attachment":[{"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/media?parent=1400"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/categories?post=1400"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/tags?post=1400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}