[dev] Re: [cvs] commit: horde/lib String.php
Amith Varghese
amith at xalan.com
Mon Jan 27 22:34:07 PST 2003
> For what it's worth, !empty() seems to be as fast as isset() (makes
> intuitive sense, since they're both engine-level calls). So perhaps:
>
> 1. use !empty() when you're checking for non-empty data.
> 2. use array_key_exists() when false or null is okay
>
attached is a patch for the CODING_STANDARDS doc to reflect Jan's findings....
Useful info for newcomers.
Amith
-------------- next part --------------
Index: CODING_STANDARDS
===================================================================
RCS file: /repository/horde/docs/CODING_STANDARDS,v
retrieving revision 1.60
diff -u -r1.60 CODING_STANDARDS
--- CODING_STANDARDS 22 Jan 2003 15:12:54 -0000 1.60
+++ CODING_STANDARDS 28 Jan 2003 03:28:17 -0000
@@ -495,3 +495,6 @@
if (!array_key_exists('charset', $params)) {
Horde::fatal('Incomplete configuration.');
}
+
+Please note that array_key_exists() is a performance hit (25%-100%)
+and should only be used when necessary.
More information about the dev
mailing list