{"id":854,"date":"2008-07-09T01:00:00","date_gmt":"2008-07-08T16:00:00","guid":{"rendered":"https:\/\/ecoop.net\/memo\/2008-07-09-1.html"},"modified":"2008-07-09T01:00:00","modified_gmt":"2008-07-08T16:00:00","slug":"2008-07-09-1","status":"publish","type":"post","link":"https:\/\/www.ecoop.net\/memo\/archives\/2008-07-09-1.html","title":{"rendered":"error_reporting=E_ALL \u306e\u30b9\u30b9\u30e1"},"content":{"rendered":"<p>\n\u521d\u6b69\u3067\u306f\u3042\u308a\u307e\u3059\u304c\u3001error_reporting = E_ALL ^ E_PHP_NOTICE \u306a\u74b0\u5883\u306b\u6163\u308c\u3066\u3044\u308b\u4eba\u306e\u305f\u3081\u306e\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u30eb\u30fc\u30eb\u3092\u63a2\u3057\u3066\u3082\u3059\u3050\u306b\u898b\u3064\u3051\u3089\u308c\u306a\u304b\u3063\u305f\u305f\u3081\u3001\u66f8\u3044\u3066\u304a\u304d\u307e\u3059\u3002<br \/>\n&nbsp;<br \/>\n\u25a1\u5909\u6570\u306f\u4ee3\u5165\u3057\u3066\u304b\u3089\u4f7f\u3046\u3053\u3068<br \/>\n\u5b9a\u7fa9\u6e08\u307f\u306e(\u5024\u304c\u5165\u3063\u3066\u3044\u308b)\u5909\u6570\u306e\u307f\u53c2\u7167\u3059\u308b\u3079\u304d\u3067\u3059\u3002<br \/>\n\u3082\u3057\u3082\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u306a\u3069\u3001\u5024\u304c\u5165\u3063\u3066\u3044\u308b\u304b\u308f\u304b\u3089\u306a\u3044\u5834\u5408\u306f isset() \u3084 empty() \u3067\u5b58\u5728\u3092\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002\u63a5\u982d\u6587\u5b57 @ \u3092\u4f7f\u3063\u3066\u3082\u3044\u3044\u3067\u3059\u304c\u3001 isset() \u3084 empty() \u306e\u307b\u3046\u304c\u671b\u307e\u3057\u3044\u3067\u3059\u3002<br \/>\n\u306a\u304a\u3001null \u3092\u4ee3\u5165\u3057\u305f\u5909\u6570\u3082\u5b9a\u7fa9\u6e08\u307f\u306e\u5909\u6570\u3067\u3059\u3002\n<\/p>\n<blockquote><p>&lt;?php<br \/>\n\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n\/\/ \u672a\u5b9a\u7fa9\u306e\u5909\u6570\u53c2\u7167<br \/>\n\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n\/\/ NG<br \/>\necho $foo;  \/\/ PHP Notice:  Undefined variable: foo<br \/>\n\/\/ &#8212;&#8212;&#8211;<br \/>\n\/\/ OK<br \/>\n$foo = &#8220;abc&#8221;;<br \/>\necho $foo; \n<\/p><\/blockquote>\n<p>&nbsp;<br \/>\n\u25a1\u914d\u5217\u3001\u9023\u60f3\u914d\u5217\u306e\u8981\u7d20\u3082\u5b58\u5728\u3059\u308b\u3082\u306e\u306e\u307f\u53c2\u7167\u3059\u308b\u3053\u3068<br \/>\n\u914d\u5217\u306e\u8981\u7d20\u306e\u4e00\u3064\u4e00\u3064\u306b\u3064\u3044\u3066\u3082\u3001\u5909\u6570\u540c\u69d8\u306b\u5b9a\u7fa9\u6e08\u307f\u306e\u3082\u306e\u306e\u307f\u53c2\u7167\u3057\u307e\u3057\u3087\u3046\u3002<br \/>\n\u30ea\u30af\u30a8\u30b9\u30c8\u5024\u306a\u3069\u3001\u5024\u304c\u5165\u3063\u3066\u3044\u308b\u304b\u308f\u304b\u3089\u306a\u3044\u5834\u5408\u306f isset() \u3084 empty() \u3067\u5b58\u5728\u3092\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002\n<\/p>\n<blockquote><p>&lt;?php<br \/>\n\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n\/\/ \u672a\u5b9a\u7fa9\u306e\u914d\u5217\u8981\u7d20\/\u9023\u60f3\u914d\u5217\u8981\u7d20\u306e\u53c2\u7167<br \/>\n\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n\/\/ NG <br \/>\n$id = $_GET[&#8216;id&#8217;]; \/\/ PHP Notice:  Undefined index:  id (\u5f15\u6570\u7701\u7565\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u5834\u5408)<br \/>\n\/\/ &#8212;&#8212;&#8211;<br \/>\n\/\/ OK \u203b\u7701\u7565\u4e0d\u53ef\u80fd\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5834\u5408<br \/>\nif(empty($_GET[&#8216;id&#8217;])){ \/\/ \u307e\u305f\u306f if( !isset($_GET[&#8216;id&#8217;]) )<br \/>\n\t\/\/ \u30a8\u30e9\u30fc\u51e6\u7406<br \/>\n\texit;<br \/>\n}<br \/>\n$id = $_GET[&#8216;id&#8217;];<br \/>\n\/\/ &#8212;&#8212;&#8211;<br \/>\n\/\/ OK-2 \u203b\u7701\u7565\u53ef\u80fd\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5834\u5408<br \/>\n$id = isset($_GET[&#8216;id&#8217;])? $_GET[&#8216;id&#8217;]: null;\n<\/p><\/blockquote>\n<p>&nbsp;<br \/>\n\u25a1\u5b9a\u6570\u306e\u5b9a\u7fa9\u65b9\u6cd5\u306b\u6ce8\u610f\u3057\u307e\u3057\u3087\u3046\u3002<br \/>\n\u5b9a\u6570\u306e\u5b9a\u7fa9\u95a2\u6570\u306f\n<\/p>\n<blockquote><p>define(\u5b9a\u6570\u540d\u6587\u5b57\u5217, \u5024)\n<\/p><\/blockquote>\n<p>\u3067\u3059\u3002<br \/>\n\u7b2c\u4e00\u5f15\u6570\u306f\u30b7\u30f3\u30dc\u30eb\u3067\u306f\u306a\u304f\u6587\u5b57\u5217\u3067\u3059\u3002&#8217;\u301c&#8217; \u3084 &#8220;\u301c&#8221; \u3067\u62ec\u308b\u3053\u3068\u3092\u5fd8\u308c\u306a\u3044\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002\n<\/p>\n<blockquote><p>&lt;?php<br \/>\n\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n\/\/ \u672a\u5b9a\u7fa9\u306e\u5b9a\u6570\u53c2\u7167(\u5b9a\u7fa9\u6642)<br \/>\n\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n\/\/ NG<br \/>\ndefine(FOO, 123); \/\/ PHP Notice:  Use of undefined constant FOO &#8211; assumed &#8216;FOO&#8217;<br \/>\n\/\/ &#8212;&#8212;&#8211;<br \/>\n\/\/ OK<br \/>\ndefine(&#8220;FOO&#8221;, 123); \n<\/p><\/blockquote>\n<p>&nbsp;<br \/>\n\u25a1\u6587\u5b57\u5217\u4e2d\u306e\u9023\u60f3\u914d\u5217\u306e\u30ad\u30fc\u6307\u5b9a\u6642\u3082\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u306b\u3082\u6ce8\u610f\n<\/p>\n<blockquote><p>&#8220;{$assoc[key]}&#8221;\n<\/p><\/blockquote>\n<p>\u306f key \u304c\u5b9a\u6570\u5024\u3068\u307f\u306a\u3055\u308c\u307e\u3059\u3002<br \/>\n\u9023\u60f3\u914d\u5217\u306e\u30ad\u30fc\u3092\u30c0\u30d6\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u307e\u305f\u306f\u30b7\u30f3\u30b0\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u56f2\u3080\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002\n<\/p>\n<blockquote><p>&lt;?php<br \/>\n\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n\/\/ \u672a\u5b9a\u7fa9\u306e\u5b9a\u6570\u53c2\u7167(\u6587\u5b57\u5217\u5185\u3067\u306e\u9023\u60f3\u914d\u5217\u53c2\u7167)<br \/>\n\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n\/\/ NG<br \/>\n$foo=array();<br \/>\n$foo[&#8220;name&#8221;]\u3000=\u3000&#8221;John&#8221;; <br \/>\necho &#8220;{$foo[name]}\\n&#8221;;\u3000\/\/ Use of undefined constant name &#8211; assumed &#8216;name&#8217;<br \/>\n\/\/ &#8212;&#8212;&#8211;<br \/>\n\/\/ OK<br \/>\n$foo=array();<br \/>\n$foo[&#8220;name&#8221;]\u3000=\u3000&#8221;John&#8221;; <br \/>\necho &#8220;{$foo[&#8216;name&#8217;]}\\n&#8221;;\n<\/p><\/blockquote>\n<p>\n","protected":false},"excerpt":{"rendered":"<p>\u521d\u6b69\u3067\u306f\u3042\u308a\u307e\u3059\u304c\u3001error_reporting = E_ALL ^ E_PHP_NOTICE \u306a\u74b0\u5883\u306b\u6163\u308c\u3066\u3044\u308b\u4eba\u306e\u305f\u3081\u306e\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u30eb\u30fc\u30eb\u3092\u63a2\u3057\u3066\u3082\u3059\u3050\u306b\u898b\u3064\u3051\u3089\u308c\u306a\u304b\u3063\u305f\u305f\u3081\u3001\u66f8\u3044\u3066\u304a\u304d\u307e\u3059\u3002 &nbsp; \u25a1\u5909 &hellip; <a href=\"https:\/\/www.ecoop.net\/memo\/archives\/2008-07-09-1.html\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">error_reporting=E_ALL \u306e\u30b9\u30b9\u30e1<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[32],"class_list":["post-854","post","type-post","status-publish","format-standard","hentry","tag-php"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/posts\/854","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/comments?post=854"}],"version-history":[{"count":0,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/posts\/854\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/media?parent=854"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/categories?post=854"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/tags?post=854"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}