{"id":3386,"date":"2020-10-15T10:32:14","date_gmt":"2020-10-15T09:32:14","guid":{"rendered":"https:\/\/ibex.tech\/cloud\/?p=3386"},"modified":"2022-02-17T07:13:47","modified_gmt":"2022-02-17T07:13:47","slug":"vs","status":"publish","type":"post","link":"https:\/\/ibex.tech\/cloud\/php\/if\/vs","title":{"rendered":"== vs ==="},"content":{"rendered":"\n<p>But the equal operator == is less strict than the identical operator === and can have some hard to predict results, so it&#8217;s typically better to only use the identical operator.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Strings<\/h4>\n\n\n\n<p>When comparing a string to an integer the string is evaluated as 0!!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  if (\"ABC\" == 0)<\/code><\/pre>\n\n\n\n<p>evaluates true because first \u201cABC\u201d is converted to integer and becomes 0 then it is compared to 0.<\/p>\n\n\n\n<p>Use === if you are comparing non strings to a string value<\/p>\n","protected":false},"excerpt":{"rendered":"<p>But the equal operator == is less strict than the identical operator === and can have some hard to predict results, so it&#8217;s typically better to only use the identical operator. Strings When comparing a string to an integer the string is evaluated as 0!! evaluates true because first \u201cABC\u201d is converted to integer and [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[276,25],"tags":[],"class_list":["post-3386","post","type-post","status-publish","format-standard","hentry","category-compare","category-if"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/3386","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=3386"}],"version-history":[{"count":3,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/3386\/revisions"}],"predecessor-version":[{"id":3944,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/3386\/revisions\/3944"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/media?parent=3386"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/categories?post=3386"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/tags?post=3386"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}