How does variable assignment in an expression work?
问题 This is a practice I've seen before, but not very often: A variable is assigned to a value at the same time the value itself is evaluated (or is it the expression itself that is evaluated?). Example: // Outputs "The value is 1" $value = 1; if ($var = $value) { echo "The value is $var"; } Seems to be the same as: $value = 1; $var = $value; if ($var) { echo "The value is $var"; } Another example: // Outputs "The value is 1" $value = 1; echo "The value is ".$var = $value; I've been using this a