The basic assignment operator is "=". Your first inclination might
be to think of this as "equal to". Don't. It really means that the
the left operand gets set to the value of the expression on the
rights (that is, "gets set to").
The value of an assignment expression is the value assigned. That
is, the value of "$a = 3" is 3. This allows you to do some tricky
things:
<?php
$a = ($b = 4) + 5; // $a is equal to 9 now, and $b has been set to 4.
?>
In addition to the basic assignment operator, there are "combined
operators" for all of the binary
arithmetic and string operators that allow you to use a value in an
expression and then set its value to the result of that expression. For
example:
<?php
$a = 3; $a += 5; // sets $a to 8, as if we had said: $a = $a + 5; $b = "Hello "; $b .= "There!"; // sets $b to "Hello There!", just like $b = $b . "There!";
?>
Note that the assignment copies the original variable to the new
one (assignment by value), so changes to one will not affect the
other. This may also have relevance if you need to copy something
like a large array inside a tight loop. Since PHP 4, assignment
by reference has been supported, using the $var =
&$othervar; syntax, but this is not possible
in PHP 3. 'Assignment by reference' means that both variables end
up pointing at the same data, and nothing is copied anywhere.
To learn more about references, please read References explained.
Php language.operators.assignment Function syntax tag
language.operators.assignment php code on this is provided for your study purpose, it will guide you to know how create and design a website using php. use it to practice and train your self online
Php language.operators.assignment syntax tutorial
php tutorial guide and code design are for easy learning and programming. The code practice section provided at the top is for practising of this syntax. Use the code section up to practice your php programming online. Learning php is very easy, all you need is to use the examples on this site and practice them to perfect your skills.