RE: [PHP] Brain Death - [PHP] functions classes

From: Date: Sat, 26 Aug 2006 18:23:36 +0000
Subject: RE: [PHP] Brain Death - [PHP] functions classes
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-241135@lists.php.net to get a copy of this message
At 2:30 PM -0400 8/26/06, Robert Cummings wrote:
On Sat, 2006-08-26 at 12:41 -0400, tedd wrote: At 4:51 PM +0100 8/26/06, Alex Turner wrote: And to be very pedantic - as null does not have a type then actually
'x === null' should evaluate to absurdity, but PHP is more pragmatic
than that ;-)
That's a very good point. While one NULL variable in php can be compared to another NULL variable and produce true, it's not so in MySQL. In MySQL NULL does not equal NULL -- such comparisons produces NULL and not true. Instead you have to use IS_NULL or NOT NULL to check for NULL. So, it's probably best to get into the habit of using is_null.
I strongly disagree... If I'm writing SQL then I adhere to the language constructs of SQL, if I'm coding in PHP then I adhere to the language constructs of PHP. There is no reason why one should forgo better constructs just because they don't appear in other languages. When in Rome... Oh btw, PHP draws strongly from C, and in C NULL == NULL, and last I checked C predates SQL. Cheers, Rob.
Rob: As the old woman who kissed the cow said "To each their own." My reasoning is simple and I don't strongly agree, or disagree, with other methodologies. I write in several languages, such as php, js, mySQL, css, and others -- and each have their own constructs. As such, I try to use similar constructs where ever possible. My memory isn't what it used to be. Besides, what Alex Turner said about NULL is correct -- it's absurd to have NULL evaluate to anything. Just because one language allows absurdity doesn't mean you have to practice it. Your mileage may differ and that's Okay. :-) tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com

« previous php.general (#241135) next »