Quantcast
Channel: WP Woodshed
Viewing all articles
Browse latest Browse all 16

Comparison Operators in PHP: “=” vs “==”

$
0
0

Given this bit of PHP:

<?php
$today = "Monday";
if ($today == "Monday")

From Treehouse’s course on PHP:

The single equal sign here assigns the value. It actually changes the value in the ‘today’ variable.

The double equal sign checks the value. It simply looks at the variable to see what the value is.

So, the single equal sign (=) defines what value the variable has.

$today = "Monday";  // The value of "Monday" is assigned to the variable "today"


Viewing all articles
Browse latest Browse all 16

Trending Articles