NYCPHP Meetup

NYPHP.org

[nycphp-talk] Why do "cool kids" choose PHP to build websites instead of Java

Anthony Wlodarski aw at sap8.com
Thu Jan 3 09:14:21 EST 2008


Zesty Ping never learned === apparently.  This one's for you Zesty:

http://www.php.net/manual/en/language.operators.comparison.php

"===" introduced type facing in php4 so it is a moot point or just poor reading skills on some developers parts if they missed this essential comparison operator...

Anthony Wlodarski
646-285-0500 x230
aw at sap8.com

-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Gary Mort
Sent: Thursday, January 03, 2008 5:14 AM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Why do "cool kids" choose PHP to build websites instead of Java

Elliotte Rusty Harold wrote:
> % cat equality.php
> <?php
>
> $a = 0;
> $b = "eggs";
> $c = "spam";
>
> print ($a == $b) ? "a == b\n" : "a != b\n";
> print ($b == $c) ? "b == c\n" : "b != c\n";
> print ($a == $c) ? "a == c\n" : "a != c\n";
> print ($a == $d) ? "a == d\n" : "a != d\n";
> print ($b == $d) ? "b == d\n" : "b != d\n";
> print ($c == $d) ? "c == d\n" : "c != d\n";
> ?>
>
I don't see this as a problem, basically the issue being raised is:
PHP does not have strong typing, this 0, NULL, and false are all 
equivalent(add a $d=false; to the definitions and everything still comes 
out with the same result).

However, knowing that these 3 values are considered the same, you can 
replace 2 equal signs with 3, ===, and get the output your expecting.
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php






More information about the talk mailing list