Harlequin
Harlequin

Reputation: 25

Checking equal values and data types

Will the following check both value and data type equality:

if ($fooBar != $fooBarNew)

Upvotes: 0

Views: 24

Answers (1)

D4V1D
D4V1D

Reputation: 5849

Use the === comparison operator like so:

if ($fooBar === $fooBarNew) {
    // both variables are identical on value and type level
}

Upvotes: 1

Related Questions