PHP assignment operator

From Wiki @ Karl Jones dot com
Jump to: navigation, search

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