{"id":111,"date":"2009-08-27T08:35:44","date_gmt":"2009-08-27T12:35:44","guid":{"rendered":"http:\/\/andyanglea.com\/blog\/?p=111"},"modified":"2009-08-27T08:35:44","modified_gmt":"2009-08-27T12:35:44","slug":"if-problems","status":"publish","type":"post","link":"https:\/\/andyanglea.com\/?p=111","title":{"rendered":"if problems"},"content":{"rendered":"<p>This is definitely one for the geek files, so if multi-condition PHP if statements mean nothing to you, feel free to move along.\u00a0 I won&#8217;t be offended.<\/p>\n<p>Ok, just geeks left?\u00a0 Good, here we go.<\/p>\n<p>Last night I was trying to correct a syntax error and came across a helpful way to determine if all the parentheses in my if statement matched each other.\u00a0 Basically how it works is like this.\u00a0 Start counting each parenthesis in your statement. Each time you see an open parenthesis you increase your count by 1 and each time you see a close parenthesis you decrease your count by 1.\u00a0 Let me illustrate:<\/p>\n<pre lang=\"PHP\" escaped=\"true\">\/\/ 12\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0           1\u00a0   23\u00a0\u00a0 4\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0     3\u00a0  \u00a0\u00a0 2\u00a0   3\u00a0\u00a0\u00a0   4\u00a0\u00a0\u00a0\u00a0\u00a0           3210\nif (($condition1 != $a) || ((len($condition2) == $b) &amp;&amp; (!isset($_POST['submit'])))) {<\/pre>\n<p>Don&#8217;t know if that helps you or not, but as the editor i was using (online) didn&#8217;t have a syntax checker, it helped me a great deal.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is definitely one for the geek files, so if multi-condition PHP if statements mean nothing to you, feel free to move along.\u00a0 I won&#8217;t be offended. Ok, just geeks left?\u00a0 Good, here we go. Last night I was trying to correct a syntax error and came across a helpful way to determine if all [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[28,41,76],"class_list":["post-111","post","type-post","status-publish","format-standard","hentry","category-technology","tag-code","tag-geek","tag-php"],"_links":{"self":[{"href":"https:\/\/andyanglea.com\/index.php?rest_route=\/wp\/v2\/posts\/111","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/andyanglea.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/andyanglea.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/andyanglea.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/andyanglea.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=111"}],"version-history":[{"count":0,"href":"https:\/\/andyanglea.com\/index.php?rest_route=\/wp\/v2\/posts\/111\/revisions"}],"wp:attachment":[{"href":"https:\/\/andyanglea.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/andyanglea.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/andyanglea.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}