scriptygoddess

22 Sep, 2004

Expression values

Posted by: Jennifer In: Bookmarks

PHP type comparison tables

For example if $x=""; what will empty($x) return? or is_null($x)? Or the even more surprising one: $x = "0" will return TRUE on empty() even though it is considered a string.

Related posts:

  1. Adding a block of HTML to a WordPress post One problem with the WYSIWYG editor in WordPress is that...

Related posts brought to you by Yet Another Related Posts Plugin.

2 Responses to "Expression values"

1 | Mark J

September 22nd, 2004 at 7:59 pm

Avatar

Very tricky stuff… don't even get me started on the triple equals… if ($x === 1)

2 | michel

September 23rd, 2004 at 6:28 pm

Avatar

This is why empty() blows and why it should be avoided.
(And why checking the data type is most usually a good idea if you need accurate results!)

Featured Sponsors

About


Advertisements