3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { protected $a; public function getA() { return $this->a; } public function setA($a) { $this->a = $a; } } $test = new Test; $test->setA("foo"); $start_time = MICROTIME(TRUE); for ($i=1; $i<=10000; $i++) { if ('' !== ($foo = $test->getA())) { echo $foo; } } $stop_time = MICROTIME(TRUE); $time = $stop_time - $start_time; PRINT "Elapsed time was $time seconds."; $start_time2 = MICROTIME(TRUE); for ($i=1; $i<=10000; $i++) { if ('' !== ($foo = $test->getA())) { echo $foo; } unset($foo); } $stop_time2 = MICROTIME(TRUE); $time2 = $stop_time2 - $start_time2; PRINT "Elapsed time was $time2 seconds."; $start_time3 = MICROTIME(TRUE); for ($i=1; $i<=10000; $i++) { if ('' !== $test->getA()) { echo $test->getA(); } } $stop_time3 = MICROTIME(TRUE); $time3 = $stop_time3 - $start_time3; PRINT "Elapsed time was $time3 seconds.";

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)
7.3.00.0140.01116.63
7.2.130.0190.01616.94
7.2.120.0140.01016.73
7.2.110.0160.01216.74
7.2.100.0100.01716.90
7.2.90.0100.01317.04
7.2.80.0040.01817.03
7.2.70.0180.00317.02
7.2.60.0250.00416.96
7.2.50.0070.01716.82
7.2.40.0210.00716.98
7.2.30.0130.01016.85
7.2.20.0190.00916.90
7.2.10.0170.01316.93
7.2.00.0190.00918.15
7.1.250.0180.00615.74
7.1.240.0180.00715.74
7.1.230.0210.00315.67
7.1.220.0180.01115.87
7.1.210.0070.01615.66
7.1.200.0190.00615.72
7.1.190.0090.01915.79
7.1.180.0130.01015.80
7.1.170.0140.01815.69
7.1.160.0270.00315.75
7.1.150.0150.01515.88
7.1.140.0100.01315.84
7.1.130.0100.01715.55
7.1.120.0130.01315.80
7.1.110.0250.00615.55
7.1.100.0230.00315.62
7.1.90.0180.00715.68
7.1.80.0130.01315.85
7.1.70.0120.01116.48
7.1.60.0080.01416.64
7.1.50.0160.01116.59
7.1.40.0190.00615.91
7.1.30.0120.00915.82
7.1.20.0160.00615.68
7.1.10.0070.01415.82
7.1.00.0170.01015.56
7.0.330.0240.00715.59
7.0.320.0210.00715.48
7.0.310.0200.00715.47
7.0.300.0250.00415.48
7.0.290.0180.00615.36
7.0.280.0140.01715.26
7.0.270.0230.01015.20
7.0.260.0170.01015.48
7.0.250.0170.02115.53
7.0.240.0210.00715.18
7.0.230.0130.01315.37
7.0.220.0200.00715.50
7.0.210.0120.00915.25
7.0.200.0150.00916.08
7.0.190.0110.01415.54
7.0.180.0200.00715.52
7.0.170.0130.01315.22
7.0.160.0140.01015.29
7.0.150.0120.01215.51
7.0.140.0110.01115.54
7.0.130.0130.01615.46
7.0.120.0160.01615.31
7.0.110.0130.02015.58
7.0.100.0100.01615.48
7.0.90.0190.01315.36
7.0.80.0230.00615.59
7.0.70.0140.01015.58
7.0.60.0170.01315.33
7.0.50.0170.01015.42
7.0.40.0160.01313.57
7.0.30.0210.00713.38
7.0.20.0170.01013.62
7.0.10.0160.00913.45
7.0.00.0160.01313.50
5.6.380.0140.01314.53
5.6.370.0130.01614.56
5.6.360.0220.00614.41
5.6.350.0160.01314.59
5.6.340.0260.01014.57
5.6.330.0110.02114.53
5.6.320.0130.01314.50
5.6.310.0170.01014.43
5.6.300.0180.01214.19
5.6.290.0140.01414.26
5.6.280.0030.02014.50
5.6.270.0220.00614.54
5.6.260.0190.00914.36
5.6.250.0140.01414.35
5.6.240.0170.01314.53
5.6.230.0220.00914.35
5.6.220.0130.02014.67
5.6.210.0210.00314.28
5.6.200.0130.01314.31
5.6.190.0180.00714.31
5.6.180.0250.00414.58
5.6.170.0100.01714.52
5.6.160.0100.02114.41
5.6.150.0200.00914.51
5.6.140.0190.00614.44
5.6.130.0150.01214.44
5.6.120.0070.01814.49
5.6.110.0160.01014.38
5.6.100.0160.01314.23
5.6.90.0030.02414.30
5.6.80.0140.01414.57
5.6.70.0090.02514.25
5.6.60.0140.01414.51
5.6.50.0190.01214.28
5.6.40.0200.00714.37
5.6.30.0200.01314.25
5.6.20.0100.01414.28
5.6.10.0140.01814.45
5.6.00.0070.02314.48
5.5.380.0060.02611.22
5.5.370.0130.01311.12
5.5.360.0170.01011.25
5.5.350.0150.00711.28
5.5.340.0160.00711.05
5.5.330.0120.01511.10
5.5.320.0090.01611.41
5.5.310.0130.01711.34
5.5.300.0140.00711.09
5.5.290.0150.00711.11
5.5.280.0130.01311.09
5.5.270.0150.00911.27
5.5.260.0160.01311.26
5.5.250.0130.01011.25
5.5.240.0180.00610.95
5.5.230.0070.01811.09
5.5.220.0140.01011.14
5.5.210.0110.01811.29
5.5.200.0100.01711.29
5.5.190.0160.01311.23
5.5.180.0210.00611.21
5.5.170.0150.00911.17
5.5.160.0250.00010.91
5.5.150.0180.00611.13
5.5.140.0160.01211.00
5.5.130.0100.01411.25
5.5.120.0200.01011.09
5.5.110.0160.00711.22
5.5.100.0090.01611.18
5.5.90.0150.00311.38
5.5.80.0120.01211.30
5.5.70.0070.01710.96
5.5.60.0150.00911.22
5.5.50.0180.00911.15
5.5.40.0200.01011.11
5.5.30.0130.01310.82
5.5.20.0140.01711.31
5.5.10.0130.01311.06
5.5.00.0200.00711.16
5.4.450.0150.00611.33
5.4.440.0170.01011.20
5.4.430.0150.00911.20
5.4.420.0160.01011.18
5.4.410.0160.01011.29
5.4.400.0070.02110.98
5.4.390.0160.01010.89
5.4.380.0030.01911.04
5.4.370.0120.01211.03
5.4.360.0110.01411.17
5.4.350.0230.00311.06
5.4.340.0140.01111.07
5.4.330.0070.01711.36
5.4.320.0210.00311.07
5.4.310.0210.00711.12
5.4.300.0140.01011.08
5.4.290.0180.00710.98
5.4.280.0140.01011.06
5.4.270.0190.00311.18
5.4.260.0160.01011.08
5.4.250.0230.00711.09
5.4.240.0100.01611.01
5.4.230.0130.01311.20
5.4.220.0130.01310.95
5.4.210.0140.01010.93
5.4.200.0150.01111.05
5.4.190.0100.01410.60
5.4.180.0130.01010.86
5.4.170.0040.01911.05
5.4.160.0130.01610.78
5.4.150.0110.01411.05
5.4.140.0150.00911.10
5.4.130.0150.01111.14
5.4.120.0220.00711.41
5.4.110.0220.00611.33
5.4.100.0220.00610.90
5.4.90.0200.00711.18
5.4.80.0230.00311.21
5.4.70.0130.01310.84
5.4.60.0070.02310.93
5.4.50.0060.01911.12
5.4.40.0070.02011.07
5.4.30.0070.01711.07
5.4.20.0100.01611.19
5.4.10.0190.00611.20
5.4.00.0150.01511.02
5.3.290.0070.01610.59
5.3.280.0130.01410.49
5.3.270.0120.01210.48
5.3.260.0160.01010.30
5.3.250.0170.01010.53
5.3.240.0200.00710.09
5.3.230.0040.01910.43
5.3.220.0100.01410.29
5.3.210.0200.00310.18
5.3.200.0100.01710.05
5.3.190.0100.01610.30
5.3.180.0160.01210.50
5.3.170.0140.00710.48
5.3.160.0130.01010.29
5.3.150.0120.01510.42
5.3.140.0170.00710.14
5.3.130.0170.00710.39
5.3.120.0130.01610.22
5.3.110.0160.00910.36
5.3.100.0250.00310.44
5.3.90.0190.00610.53
5.3.80.0130.01310.27
5.3.70.0130.01010.28
5.3.60.0070.02010.15
5.3.50.0090.01510.36
5.3.40.0060.01810.41
5.3.30.0230.00310.51
5.3.20.0170.01010.37
5.3.10.0150.01110.22
5.3.00.0170.0149.96

preferences:
37.32 ms | 401 KiB | 5 Q