From d91685cbbac2092e5ffdc12ad1ca03b0a71443d4 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Thu, 30 May 2013 17:04:13 +0300 Subject: [PATCH] Stop recommending `and`/`or` over `&&`/`||` The coding guidelines suggest using `and` and `or` over `&&` and `||`. Frankly I don't think this is a good idea. The precedence rules for `and` and `or` are so weird, they will cause lots of confusion and edge cases. To illustrate this, look at the following example ([from logical operators][0]): $x = false or true; What do you expect the value of `$x` to be? It's `false`, because `or` has lower precedence than `=`. So while you expected the expression to be: $x = (false or true); It is in fact: ($x = false) or true; Stop using `and`/`or` as logical operators. They were designed for flow control. [0]: http://php.net/manual/en/language.operators.logical.php --- contributing.md | 1 - 1 file changed, 1 deletion(-) diff --git a/contributing.md b/contributing.md index 5192ac361cb..32f12fc1a5a 100644 --- a/contributing.md +++ b/contributing.md @@ -28,5 +28,4 @@ Laravel follows the [PSR-0](https://github.com/php-fig/fig-standards/blob/master - Namespace declarations should be on the same line as `