3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Benchmark example $string = '1234567890123456789012345678901234567890'; // Measure time for strict comparison $start = microtime(true); for ($i = 0; $i < 1000000; $i++) { if ('' === $string) { // Do something } } $end = microtime(true); $strictComparisonTime = $end - $start; // Measure time for count function $start = microtime(true); for ($i = 0; $i < 1000000; $i++) { if (\strlen($string)) { // Do something } } $end = microtime(true); $countFunctionTime = $end - $start; // Output the results echo "Time taken for strict comparison: " . $strictComparisonTime . " seconds\n"; echo "Time taken for strlen function: " . $countFunctionTime . " seconds\n";

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.2.110.0200.03722.21
8.2.100.0030.02320.64
8.2.90.0060.01920.59
8.2.80.0100.04120.33
8.2.70.0030.02320.37
8.2.60.0130.03020.26
8.2.50.0030.02318.60
8.2.40.0120.01518.83
8.2.30.0070.04318.75
8.2.20.0030.02418.54
8.2.10.0070.02018.70
8.2.00.0100.01720.39
8.1.240.0100.01718.50
8.1.230.0030.02518.54
8.1.220.0030.02318.37
8.1.210.0100.01619.92
8.1.200.0090.01818.42
8.1.190.0070.02118.31
8.1.180.0030.02318.30
8.1.170.0030.02318.49
8.1.160.0120.01520.10
8.1.150.0030.02418.74
8.1.140.0100.01718.49
8.1.130.0030.02318.36
8.1.120.0190.04218.44
8.1.110.0100.01718.59
8.1.100.0070.02018.57
8.1.90.0100.01718.55
8.1.80.0060.02118.62
8.1.70.0070.03118.56
8.1.60.0090.01818.69
8.1.50.0000.02818.61
8.1.40.0070.02018.67
8.1.30.0090.01918.73
8.1.20.0000.02618.80
8.1.10.0070.04118.69
8.1.00.0100.01618.69
8.0.300.0030.02317.96
8.0.290.0030.02417.74
8.0.280.0070.01917.83
8.0.270.0000.02617.91
8.0.260.0100.01617.77
8.0.250.0090.01817.94
8.0.240.0060.01919.79
8.0.230.0100.04819.64
8.0.220.0170.03819.42
8.0.210.0030.02319.69
8.0.200.0070.04619.68
8.0.190.0080.01919.64
8.0.180.0040.02919.83
8.0.170.0170.03319.52
8.0.160.0100.01619.75
8.0.150.0160.03819.55
8.0.140.0030.02319.62
8.0.130.0030.02319.73
8.0.120.0100.01719.57
8.0.110.0100.01719.88
8.0.100.0070.01919.66
8.0.90.0070.02019.64
8.0.80.0040.02219.70
8.0.70.0030.02419.81
8.0.60.0100.01619.70
8.0.50.0030.02319.54
8.0.30.0070.02019.64
8.0.20.0030.02319.75
8.0.10.0030.02319.95

preferences:
40.66 ms | 403 KiB | 5 Q