PHP assignment operator

From Wiki @ Karl Jones dot com
Revision as of 19:03, 20 September 2016 by Karl Jones (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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