{"id":11,"date":"2009-04-14T17:11:00","date_gmt":"2009-04-14T17:11:00","guid":{"rendered":"http:\/\/www.codeboss.in\/web-funda\/?p=11"},"modified":"2009-04-14T17:11:00","modified_gmt":"2009-04-14T17:11:00","slug":"dynamic-conditions-in-php","status":"publish","type":"post","link":"https:\/\/codeboss.in\/web-funda\/2009\/04\/14\/dynamic-conditions-in-php\/","title":{"rendered":"Dynamic conditions in PHP"},"content":{"rendered":"<p>The below example demonstrates how we can check dynamic conditions in PHP.<\/p>\n<pre class=\"brush: php;\">\n$var1 = 11;\n$var2 = 110;\n$cond1 = '$var1 > $var2';\n$cond2 = '$var1 < $var2';\n\nif(eval(\"return $cond1;\")){\necho $cond1;\n}\n\nif(eval(\"return $cond2;\")){\necho $cond2;\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The below example demonstrates how we can check dynamic conditions in PHP. $var1 = 11; $var2 = 110; $cond1 = &#8216;$var1 > $var2&#8217;; $cond2 = &#8216;$var1 < $var2'; if(eval(\"return $cond1;\")){ echo $cond1; } if(eval(\"return $cond2;\")){ echo $cond2; }\n<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[57],"class_list":["post-11","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-php","entry"],"_links":{"self":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/posts\/11","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/comments?post=11"}],"version-history":[{"count":0,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/posts\/11\/revisions"}],"wp:attachment":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/media?parent=11"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/categories?post=11"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/tags?post=11"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}