if statement

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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

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.

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

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
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

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: Yahoo [Bot] and 8 guests