Krafty Internet Marketing Forum
Assignment - Printable Version

+- Krafty Internet Marketing Forum (https://kraftymarketingprofits.com/internetmarketingforum)
+-- Forum: Internet Marketing Tips, Tricks, Courses & Bots! (https://kraftymarketingprofits.com/internetmarketingforum/Forum-internet-marketing-tips-tricks-courses-bots--50)
+--- Forum: Internet Marketing Courses! (https://kraftymarketingprofits.com/internetmarketingforum/Forum-internet-marketing-courses--25)
+--- Thread: Assignment (/Thread-assignment--561)



Assignment - beinghchinmay - 05-20-2016

The basic assignment operator (=) assigns a value to a variable. The lefthand operand is always a variable. The righthand operand can be any expression?any simple literal, variable, or complex expression. The righthand operand's value is stored in the variable named by the lefthand operand.

Because all operators are required to return a value, the assignment operator returns the value assigned to the variable. For example, the expression $a = 5 not only assigns 5 to $a, but also behaves as the value 5 if used in a larger expression. Consider the following expressions:

Quote:$a = 5;
$b = 10;
$c = ($a = $b);
 
The expression $a = $b is evaluated first, because of the parentheses. Now, both $a and $b have thesame value, 10. Finally, $c is assigned the result of the expression $a = $b, which is the value assignedto the lefhand operand (in this case, $a). When the full expression is done evaluating, all three variablescontain the same value, 10.