Re: Re: "isset" or "array_key_exists"?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2006-02-18 at 04:56, Rafael wrote:
> 	After a little test, although the results are not conclusive, I would 
> say that isset(), and also that array_key_exists() may even use isset() 
> (or similiar) internally as a first step -let's remember that isset() 
> only does a "fast search" and it returns FALSE if the value is NULL; on 
> the other hand, array_key_exists() returns TRUE even if the value is 
> NULL-  I said this (as an hypotesis) because the difference in time when 
> the key exists and when it doesn't is quite big, sometimes about 10 
> times slower.

isset is a keyword in PHP
array_key_exists() is a function.

Keywords are much faster than functions due tot he overhead functions
occur for setting up the stack.

If you don't care about null values, use isset(). If you do, use
array_key_exists().

The reason isset() doesn't return true for null entries has been
described in the past. The official stance was that null is not a value.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux