PHP Benchmarks

Performance comparison of PHP code alternatives.

Test: defined vs. isset

No Description

View test history (8) Run this test again Return to test menu

Result: Discarded

The test labeled "defined()" was the faster by 0.0406 seconds, (6.657% faster)

defined() 100%
isset() 93.343%

The defined() test took 0.5699 seconds.
The isset() test took 0.6106 seconds.


Each test case ran 20 random code order iterations consisting of 139,763 loops for a total of 2,795,260 runs.

  • Line execution difference (0.000015) milliseconds.
  • Avg difference (2.032) milliseconds per 139,763 loops.
  • Total difference 40.64 milliseconds for 2,795,260 loops

The iteration variablity for Code 1 was (1.6868) milliseconds and Code 2 was (2.2664) milliseconds. The lower and the closer together there values are the more accurate the results are.


The first test, "defined()", was:

$GLOBALS['test'] = defined('CONSTANT');

The second test, "isset()", was:

$GLOBALS['test'] = isset($GLOBALS['CONSTANT']);

Running: Linux (x86_64:1 GB) PHP (