{"id":4459,"date":"2023-01-13T20:54:26","date_gmt":"2023-01-13T20:54:26","guid":{"rendered":"https:\/\/ibex.tech\/cloud\/?p=4459"},"modified":"2023-01-13T20:54:27","modified_gmt":"2023-01-13T20:54:27","slug":"is-value-bool","status":"publish","type":"post","link":"https:\/\/ibex.tech\/cloud\/php\/boolean\/is-value-bool","title":{"rendered":"Is value bool"},"content":{"rendered":"\n<p>You can use boolval(), but it doesn&#8217;t produce correct results for &#8220;True&#8221; and &#8220;False&#8221; values.<\/p>\n\n\n\n<p>This is the better method:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if (filter_var($MyVariable, FILTER_VALIDATE_BOOLEAN))\n{\n \/\/Value is true\n}\n\nif (!filter_var($MyVariable, FILTER_VALIDATE_BOOLEAN))\n{\n \/\/Value is false\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>You can use boolval(), but it doesn&#8217;t produce correct results for &#8220;True&#8221; and &#8220;False&#8221; values. This is the better method:<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[144],"tags":[],"class_list":["post-4459","post","type-post","status-publish","format-standard","hentry","category-boolean"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/4459","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/comments?post=4459"}],"version-history":[{"count":1,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/4459\/revisions"}],"predecessor-version":[{"id":4460,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/4459\/revisions\/4460"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/media?parent=4459"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/categories?post=4459"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/tags?post=4459"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}