![]() ![]() No subsequent accesses will generate a notice. Remember that $a will be declared after the first attempt to generate a notice. $myvalue = isset($_REQUEST) ? $_REQUEST : '' Author Brandon Posted on DecemDecemCategories Linux System Administration, Programming $myvalue = !empty($_REQUEST) ? $_REQUEST : '' I included it here, because it often make the code a little more readable than the !empty($a) syntax. Using ifset() also has no performance impact, but is not exactly the same as ‘if($a)’ since isset() will return true if the variable is set to a false value. Using !empty() should be a drop-in replacement that doesn’t generate the notice and has virtually no performance impact. In summary, using the if (isset($a) & $a) syntax is about 8-10% slower than generating the PHP Notice. ![]() It measures the time to perform 1 million tests using a defined percentage of values that are set. It then computes the difference as a percentage of the time taken for the original test (the one that generates the notices).  A ‘diff’ of 100 means that the execution time is the same, greater than 100 means that it is faster, and less than 100 means that it is slower.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |