Difference between revisions of "PHP assignment operator"

From Wiki @ Karl Jones dot com
Jump to: navigation, search
(Created page with "In PHP, the '''assignment operator''' is an equal sign ('''='''). The assignment operator assigns a value to a variable. == Example == <pre> <?php $msg...")
 
 
Line 15: Line 15:
  
 
The [[PHP text generation|echo]] keyword then displays "Hello World" for the user.
 
The [[PHP text generation|echo]] keyword then displays "Hello World" for the user.
 +
 +
== Not to be confused with ==
 +
 +
Do not confuse the assignment operator with:
 +
 +
* Double equal sign (==)
 +
* Triple equal sign (===)
 +
 +
Double and triple equal signs are comparative operators.
  
 
== See also ==
 
== See also ==
  
 +
* [[Assignment (computer science)]]
 
* [[PHP variable]]
 
* [[PHP variable]]
  

Latest revision as of 19:03, 20 September 2016

In PHP, the assignment operator is an equal sign (=).

The assignment operator assigns a value to a variable.

Example

<?php
$msg = "Hello World";
echo $msg;
?>

The above example assigns the value "Hello World" to a variable named $msg.

The echo keyword then displays "Hello World" for the user.

Not to be confused with

Do not confuse the assignment operator with:

  • Double equal sign (==)
  • Triple equal sign (===)

Double and triple equal signs are comparative operators.

See also

External links