php - Conditional statement operands order -


I often stumbled on the following approach to defining a conditional statement:

  if == = $ Expr) {...}  

I have many questions about it.

  1. What is the meaning of using constant values, 1, 0, 123, 'string' etc.) instead of the second place as the first operand, when the second The operand is not too long. For example, I would like to put false as the first circuit when I have a statement:

    if (incorrect === file_put_contents ($ file_path, $ document ['title']. PHP_EOL PHP_EOL. $ Document ['body'])) {...}

  2. Does it make sense to use the language of such interpretation that Php? I agree that this is compiled languages ​​like Java like when we want to avoid NullPointerException or similar cases. Am i right

  3. Are you useful to use continuous values ​​as a first circulated? Actually it comes with a quick typing error such as C:

  4.   if (lenght = 0) {...}  

    Where variables are set to an unknown value compared to A compiler error will arise behind the desired comparison.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -