3v4l.org

run code in 300+ PHP versions simultaneously
<?php /*** * EN: Code samples written in PHP 5 by Louis Fontaine, 2016 * Three simple code samples + unit tests, allowed to be distributed by Treffer Uitzendbureau. For ease * of distribution, all code is contained in a single file. * Sample one outputs HTML code for a very simple web page using some dynamic content. * Sample two ... * Sample three consists of excerpts from code currently in production at a former client, used to * geocode zipcodes by accessing a 3rd party web service and estimate the distance to a user's location. * * NL: Voorbeeldcode in PHP 5 door Louis Fontaine, 2016 * Drie simpele stukken voorbeeldcode + unit tests, uit te geven door Treffer Uitzendbureau. Om de code * makkelijker te kunnen verspreiden, is alles samengevoegd in één bestand. * Voorbeeld één geeft als output HTML code van een simpele webpagina met wat dynamische content. * Voorbeeld twee ... * Voorbeeld drie bestaat uit fragmenten van code die momenteel in productie zijn bij een voormalige cliënt * met als functie het geocoderen van postcodes met behulp van een 3rd party webservice en het schatten van * afstanden tot de huidige locatie van de gebruiker. ***/ function runAllSamples(){ sample1(); sample2(); sample3(); runAllUnitTests(); } function sample1(){ $pageWriter = new PageWriter(); $pageWriter->write(); } class PageWriter{ private $useRandom = false; function __construct($testMode = false){ $useRandom = !$testMode; } function write(){ ?> <?php } } function runAllUnitTests(){ $pageWriter = new PageWriter(false); $success = compareWebPageHTML($pageWriter.write()); echo 'Unit test PageWriter (sample one): ' . $success ? 'success' : 'failed'; } runAllSamples(); ?>

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.3.40.0040.01818.85
8.3.30.0150.00618.77
8.3.20.0110.00720.33
8.3.10.0110.00721.77
8.3.00.0110.00721.73
8.2.170.0180.00422.96
8.2.160.0000.01420.52
8.2.150.0060.00325.66
8.2.140.0030.00524.66
8.2.130.0090.00021.01
8.2.120.0040.00426.35
8.2.110.0000.00819.45
8.2.100.0060.00617.91
8.2.90.0040.00419.05
8.2.80.0030.00517.97
8.2.70.0040.00417.63
8.2.60.0030.00617.93
8.2.50.0090.00018.09
8.2.40.0090.00022.18
8.2.30.0030.00319.35
8.2.20.0050.00319.51
8.2.10.0000.00717.97
8.2.00.0040.00418.09
8.1.270.0040.00422.14
8.1.260.0050.00328.09
8.1.250.0030.01428.09
8.1.240.0030.00620.85
8.1.230.0080.00317.52
8.1.220.0040.00417.76
8.1.210.0050.00318.77
8.1.200.0100.00017.23
8.1.190.0000.00817.23
8.1.180.0040.00418.10
8.1.170.0000.01118.56
8.1.160.0030.00520.84
8.1.150.0030.00618.98
8.1.140.0050.00319.60
8.1.130.0000.00717.83
8.1.120.0000.00717.49
8.1.110.0040.00417.38
8.1.100.0040.00417.39
8.1.90.0000.00717.50
8.1.80.0030.00317.38
8.1.70.0030.00317.51
8.1.60.0070.00317.67
8.1.50.0060.00317.54
8.1.40.0040.00417.54
8.1.30.0040.00417.65
8.1.20.0040.00417.63
8.1.10.0050.00317.49
8.1.00.0040.00817.54
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0030.00318.36
8.0.270.0000.00717.29
8.0.260.0060.00317.19
8.0.250.0000.00717.10
8.0.240.0040.00416.93
8.0.230.0030.00516.92
8.0.220.0020.00517.02
8.0.210.0040.00416.85
8.0.200.0000.00616.94
8.0.190.0030.00717.09
8.0.180.0040.00417.02
8.0.170.0080.00016.97
8.0.160.0000.00716.96
8.0.150.0000.00716.90
8.0.140.0000.00716.99
8.0.130.0000.00613.37
8.0.120.0040.00416.97
8.0.110.0070.00016.96
8.0.100.0000.00816.84
8.0.90.0050.00216.84
8.0.80.0090.01216.86
8.0.70.0040.00416.92
8.0.60.0000.00716.96
8.0.50.0040.00416.81
8.0.30.0170.00317.14
8.0.20.0090.01217.40
8.0.10.0040.00417.15
8.0.00.0130.00416.86
7.4.330.0030.00316.83
7.4.320.0030.00316.55
7.4.300.0000.00716.68
7.4.290.0000.00716.54
7.4.280.0070.00016.54
7.4.270.0000.00716.68
7.4.260.0070.00016.52
7.4.250.0000.00716.39
7.4.240.0030.00316.40
7.4.230.0000.00716.46
7.4.220.0030.01516.52
7.4.210.0100.00616.56
7.4.200.0030.00316.42
7.4.160.0060.00916.43
7.4.150.0120.00917.40
7.4.140.0100.00817.86
7.4.130.0090.01016.54
7.4.120.0090.00916.64
7.4.110.0130.00316.56
7.4.100.0070.01016.66
7.4.90.0000.01816.48
7.4.80.0150.00919.39
7.4.70.0000.01716.62
7.4.60.0030.01216.48
7.4.50.0090.00616.61
7.4.40.0060.01016.41
7.4.30.0130.00916.67
7.4.00.0030.00914.91
7.3.330.0030.00313.22
7.3.320.0050.00013.17
7.3.310.0030.00316.29
7.3.300.0000.00616.25
7.3.290.0040.00416.36
7.3.280.0080.01116.43
7.3.270.0150.00317.40
7.3.260.0060.01216.31
7.3.250.0080.01116.45
7.3.240.0120.00516.52
7.3.230.0080.01116.39
7.3.210.0070.01116.41
7.3.200.0140.00719.39
7.3.190.0240.01716.34
7.3.180.0070.01016.46
7.3.170.0080.01316.44
7.3.160.0140.00316.51
7.3.120.0040.01117.15
7.3.110.0090.00317.15
7.3.100.0070.00417.15
7.3.90.0090.00317.15
7.3.80.0120.00317.15
7.3.70.0060.00317.15
7.3.60.0080.00817.15
7.3.50.0120.00017.15
7.3.40.0060.00917.15
7.3.30.0080.00317.15
7.3.20.0110.00317.15
7.3.10.0060.00317.15
7.3.00.0060.01117.15
7.2.330.0070.01016.43
7.2.320.0060.01516.32
7.2.310.0130.00316.50
7.2.300.0100.01016.73
7.2.290.0030.01316.35
7.2.240.0000.01417.15
7.2.230.0040.00717.15
7.2.220.0000.01317.15
7.2.210.0040.01117.15
7.2.200.0060.00917.15
7.2.190.0040.01517.15
7.2.180.0060.00617.15
7.2.170.0000.01317.15
7.2.160.0110.00317.15
7.2.150.0070.00717.15
7.2.140.0040.01517.15
7.2.130.0030.01217.15
7.2.120.0090.00917.15
7.2.110.0110.00717.15
7.2.100.0090.00317.15
7.2.90.0100.00717.15
7.2.80.0070.01017.15
7.2.70.0030.01517.15
7.2.60.0080.00417.06
7.2.50.0130.00317.15
7.2.40.0060.01017.15
7.2.30.0060.01017.15
7.2.20.0030.01217.15
7.2.10.0060.01217.15
7.2.00.0080.00318.16
7.1.330.0000.01717.15
7.1.320.0160.00017.15
7.1.310.0000.01017.15
7.1.300.0030.00617.15
7.1.290.0090.00317.15
7.1.280.0090.00617.15
7.1.270.0070.00717.15
7.1.260.0090.00317.15
7.1.250.0030.01317.15
7.1.200.0030.01015.74
7.1.100.0050.00517.95
7.1.70.0040.00416.90
7.1.60.0120.01219.40
7.1.50.0060.00916.80
7.1.00.0000.07722.45
7.0.200.0000.01016.72
7.0.60.0170.03021.73
7.0.50.0030.05317.83
7.0.40.0070.05020.23
7.0.30.0330.07320.06
7.0.20.0370.07720.15
7.0.10.0070.08320.15
7.0.00.0100.07720.10
5.6.280.0030.03321.05
5.6.210.0000.08720.48
5.6.200.0070.08018.16
5.6.190.0070.08320.64
5.6.180.0230.07320.46
5.6.170.0270.05020.62
5.6.160.0070.04020.44
5.6.150.0130.07718.13
5.6.140.0130.05318.15
5.6.130.0070.08018.12
5.6.120.0170.07321.03
5.6.110.0000.04321.15
5.6.100.0030.08020.99
5.6.90.0070.08721.07
5.6.80.0170.04720.45
5.5.350.0130.03720.44
5.5.340.0030.03718.08
5.5.330.0130.03020.30
5.5.320.0270.07720.36
5.5.310.0200.08720.34
5.5.300.0030.07017.93
5.5.290.0070.03718.08
5.5.280.0030.08020.86
5.5.270.0130.07720.85
5.5.260.0070.08720.91
5.5.250.0000.06720.72
5.5.240.0330.06320.13

preferences:
52.52 ms | 400 KiB | 5 Q