Home >Backend Development >PHP Tutorial >Comparison of execution time of PHP isset() and empty() functions_PHP tutorial
The article uses charts to tell you about the comparison of PHP isset() and empty() function execution times and the performance of the functions. Friends in need can take a detailed look. The performance test uses Benchmark_Iterate class tools for debugging, focusing mainly on the execution time of isset() and empty() functions.
, Test environment
Operating system: Window isset() and empty are executed 50 times and generate a chart when the variable exists and does not exist
3. isset() and empty() determine when the variable does not exist
The code is as follows |
Copy code
|
||||||||
require_once "Benchmark/Iterate.php"; $bench = new Benchmark_Iterate;
isset($var); !empty($var); }$bench->run(50,"check1",$var);
3, and empty() when judging that the variable does not exist ![]() ![]() | Illustration: empty () determines that the variable does not exist. The average execution time is between 0.0010-0.0011 seconds
The code is as follows
|
Copy code |