BusinessesE-Learning

Livecoding.tv Quiz of the Day: 28/10/2016

php quiz

Answer:

Surprisingly to many, the above code will output bool(true) seeming to imply that the and operator is behaving instead as an or.

The issue here is that the = operator takes precedence over the and operator in order of operations, so the statement $x = true and false ends up being functionally equivalent to:

[/crayon] This is, incidentally, a great example of why using parentheses to clearly specify your intent is generally a good practice, in any language. For example, if the above statement $x = true and false were replaced with $x = (true and false), then $x would be set to false as expected.

If you want to explore more, visit our PHP edu & tutorials section! Below are some examples:

PHP Super Basics & Possible Code Clash!

Temple – PHP Language engine

 

Related posts
Content CreatorsE-Learning

Become a LEDU Community Mod and Earn LEDU each month

Artificial IntelligenceBusinesses

CPU, GPU, FGPA, or DSP: Heterogeneous Computing Multiplies the Processing Power

BusinessesCoding Community

Achieving the Best QoE: Performance Libraries Accelerate Code Execution

Artificial IntelligenceBusinesses

Making Computer Vision Real Today – For Any Application