if statement

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Xerpher
New php-forum User
New php-forum User
Posts: 164
Joined: Tue Aug 27, 2002 8:25 pm
Location: Ontario, Canada
Contact:

if statement

Postby Xerpher » Sat Feb 22, 2003 8:37 pm

I understand doing something like this

Code: Select all

if ($one == $two) three();

but what I dont understand is

Code: Select all

if ($one === $two) three();


What is the third equal sign do? I tried searching in php.net but didn't find it.

User avatar
pootergeist
New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK
Contact:

Postby pootergeist » Sun Feb 23, 2003 3:27 am

=== = exactly the same (including type)

1 == 01
1 !=== 01

1 == '1'
1 !=== '1'

the typecasted === is rarely used though.

User avatar
WiZARD
Moderator
Moderator
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Re: if statement

Postby WiZARD » Sun Feb 23, 2003 4:54 am

If you want to understand how it's work to you need to know what === it's called like equal if some variables for example $a and $b but $a is string and $b is not yore have a fail :^(


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 0 guests