Daniel Convissor wrote:
Paul:
On Thu, Jul 17, 2008 at 02:58:00PM -0400, [EMAIL PROTECTED] wrote:
isset($array[$key])
how's that different from array_key_exists?
isset() thinks NULL is not set. Similarly, empty() can be used for stuff
like this, but of course, it thinks NULL, 0, FALSE and "" are all the
same. Which function to use depends on how your program needs to work.
I also prefer array_key_exists - mostly due to being exactly what I need
when I use it (checking for a key, though I recall seeing somewhere
(sorry no source, but should be easy enough to test), that isset is
somewhat faster than array_key_exists.
Anyways, I like the article, but I noticed 2 errors.
You forgot an "I" in "mplementations" in the 2nd paragraph.
And you have an extra closing parentheses in one of your early examples:
[11] if ($_GET["q"])) { // <-- Extra Closing Paren.
[12] throw new InvalidInputException("You must specify a query");
[13] }
Have a great weekend NYPHP!
Mark
_______________________________________________
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