{"id":102,"date":"2005-10-14T07:45:04","date_gmt":"2005-10-14T11:45:04","guid":{"rendered":"http:\/\/crschmidt.net\/blog\/?p=102"},"modified":"2005-10-14T07:45:04","modified_gmt":"2005-10-14T11:45:04","slug":"logical-and-precedence","status":"publish","type":"post","link":"https:\/\/crschmidt.net\/blog\/archives\/102\/logical-and-precedence\/","title":{"rendered":"Logical and Precedence"},"content":{"rendered":"<p>Something I was previously unaware of:<\/p>\n<blockquote cite=\"http:\/\/www.php.net\/manual\/en\/language.operators.logical.php\"><p> The reason for the two different variations of &#8220;and&#8221; and &#8220;or&#8221; operators is that they operate at different precedences.<\/p><\/blockquote>\n<p>PHP&#8217;s &#038;&#038; vs. and have <a href=\"http:\/\/www.php.net\/manual\/en\/language.operators.php#language.operators.precedence\">different precedence<\/a>? Who thought this was a smart idea? What end or purpose could it possibly serve?<\/p>\n<p>Yet another one of the things that just makes me smack my head. It does explain a few things &#8212; why I couldn&#8217;t do variable setting as I might in Perl, a la:<\/p>\n<p> $var = $test || $default;<\/p>\n<p>In this case, the test occurs first, setting $var = 1; Had I used:<\/p>\n<p> $var = $test or $default;<\/p>\n<p>All would have been fine.<\/p>\n<p>How can someone think this is sane?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Something I was previously unaware of: The reason for the two different variations of &#8220;and&#8221; and &#8220;or&#8221; operators is that they operate at different precedences. PHP&#8217;s &#038;&#038; vs. and have different precedence? Who thought this was a smart idea? What end or purpose could it possibly serve? Yet another one of the things that just [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30,28,1],"tags":[],"class_list":["post-102","post","type-post","status-publish","format-standard","hentry","category-perl","category-php","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/posts\/102","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/comments?post=102"}],"version-history":[{"count":0,"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/posts\/102\/revisions"}],"wp:attachment":[{"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/media?parent=102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/categories?post=102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/crschmidt.net\/blog\/wp-json\/wp\/v2\/tags?post=102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}