3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getBaconSentences($len) { $paragraph = ""; $words = array( "upper" => array("The", "A", "One", "Some", "Any"), "lower" => array("the", "a", "one", "some", "any"), "noun" => array("boy", "girl", "dog", "town", "car"), "verb" => array("drove", "jumped", "ran", "walked", "skipped"), "prep" => array("to", "from", "over", "under", "on"), "adj" => array('tiny', 'freezing', 'lazy','boiling','filthy') ); $structures = array( array('upper', 'noun', 'verb', 'prep', 'lower', 'noun'), array('upper', 'noun', 'verb', 'prep', 'lower', 'adj', 'noun') ); while($len--) { $sentence = array(); $randStructure = array_rand($structures); for($i=0; $i<count($structure[$randStructure]); $i++) { echo json_encode($randStructure); $word = ' ';//array_rand($words[$randStructure[$i]]); $sentence[] = $word ; } $paragraph .= implode(" ", $sentence) . '. '; } return $paragraph; } echo getBaconSentences(10);

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.4.10.0040.01515.20
7.4.00.0100.00315.18
7.3.130.0100.01014.93
7.3.120.0030.01414.66
7.3.110.0030.01614.98
7.3.100.0070.01014.78
7.3.90.0000.01514.95
7.3.80.0070.00715.06
7.3.70.0070.00314.95
7.3.60.0030.01014.74
7.3.50.0070.00714.95
7.3.40.0100.00314.78
7.3.30.0050.00515.04
7.3.20.0120.00816.73
7.3.10.0060.00916.74
7.3.00.0000.01816.82
7.2.260.0110.00714.79
7.2.250.0070.01114.75
7.2.240.0040.01114.66
7.2.230.0070.00714.88
7.2.220.0000.01915.09
7.2.210.0090.00615.00
7.2.200.0060.00314.89
7.2.190.0110.00715.02
7.2.180.0030.00614.90
7.2.170.0060.00814.97
7.2.160.0060.00315.05
7.2.150.0040.01116.72
7.2.140.0060.00916.59
7.2.130.0090.00316.96
7.2.120.0070.01016.98
7.2.110.0030.01417.07
7.2.100.0030.01317.02
7.2.90.0000.00916.76
7.2.80.0040.01417.18
7.2.70.0130.00317.00
7.2.60.0030.00716.89
7.2.50.0000.01217.01
7.2.40.0000.01016.86
7.2.30.0070.00717.06
7.2.20.0060.00316.85
7.2.10.0060.00617.04
7.2.00.0020.01118.19
7.1.330.0080.00315.76
7.1.320.0090.00316.02
7.1.310.0080.00816.01
7.1.300.0030.00515.84
7.1.290.0060.00615.58
7.1.280.0100.00315.85
7.1.270.0040.00715.60
7.1.260.0090.00615.91
7.1.250.0030.01015.88
7.1.240.0000.01515.54
7.1.230.0050.00515.91
7.1.220.0060.00315.79
7.1.210.0070.00715.83
7.1.200.0030.01015.88
7.1.190.0060.00815.55
7.1.180.0000.00815.93
7.1.170.0000.01415.93
7.1.160.0030.01015.86
7.1.150.0030.00615.94
7.1.140.0000.01315.71
7.1.130.0090.00615.65
7.1.120.0000.01015.98
7.1.110.0000.01715.87
7.1.100.0100.00315.61
7.1.90.0050.00515.77
7.1.80.0070.00715.97
7.1.70.0050.01016.64
7.1.60.0100.00817.50
7.1.50.0070.01116.49
7.1.40.0070.01015.84
7.1.30.0070.01015.95
7.1.20.0080.00815.88
7.1.10.0000.00915.71
7.1.00.0020.04519.16
7.0.330.0030.00915.41
7.0.320.0060.00315.50
7.0.310.0000.01415.33
7.0.300.0070.00715.52
7.0.290.0030.01015.41
7.0.280.0070.00715.06
7.0.270.0030.00715.57
7.0.260.0030.01215.21
7.0.250.0000.01415.52
7.0.240.0060.00315.61
7.0.230.0090.00915.25
7.0.220.0000.01315.62
7.0.210.0000.01415.11
7.0.200.0060.00616.11
7.0.190.0030.00715.38
7.0.180.0060.01115.45
7.0.170.0060.00615.54
7.0.160.0040.00715.48
7.0.150.0000.00915.57
7.0.140.0030.04218.82
7.0.130.0060.00615.18
7.0.120.0070.00415.41
7.0.110.0030.01015.59
7.0.100.0030.01015.42
7.0.90.0110.03417.67
7.0.80.0150.03717.76
7.0.70.0250.02817.64
7.0.60.0280.05417.71
7.0.50.0150.04717.85
7.0.40.0050.03416.61
7.0.30.0100.02616.88
7.0.20.0080.04516.82
7.0.10.0070.04416.70
7.0.00.0050.04316.74
5.6.400.0130.00614.60
5.6.390.0040.00714.39
5.6.380.0040.00814.09
5.6.370.0040.00814.55
5.6.360.0070.00414.44
5.6.350.0080.00414.05
5.6.340.0070.00614.19
5.6.330.0060.00614.07
5.6.320.0070.00714.32
5.6.310.0030.01614.32
5.6.300.0070.00714.48
5.6.290.0000.01314.36
5.6.280.0050.03917.92
5.6.270.0060.01014.19
5.6.260.0030.01314.76
5.6.250.0070.00414.38
5.6.240.0130.03917.38
5.6.230.0070.04317.50
5.6.220.0020.03117.56
5.6.210.0070.04017.35
5.6.200.0070.04317.87
5.6.190.0030.04817.89
5.6.180.0080.04617.70
5.6.170.0030.02917.61
5.6.160.0100.04217.73
5.6.150.0070.03817.59
5.6.140.0140.03817.79
5.6.130.0070.04517.64
5.6.120.0050.04517.86
5.6.110.0050.04017.77
5.6.100.0140.03517.82
5.6.90.0030.04217.56
5.6.80.0050.04517.30
5.6.70.0050.03117.43
5.6.60.0040.03417.51
5.6.50.0070.04317.26
5.6.40.0080.03817.20
5.6.30.0070.03217.32
5.6.20.0050.04217.52
5.6.10.0070.03017.44
5.6.00.0120.03317.37
5.5.380.0060.04517.32
5.5.370.0070.04417.32
5.5.360.0030.03617.30
5.5.350.0070.04317.35
5.5.340.0100.04717.44
5.5.330.0070.04517.53
5.5.320.0120.03817.61
5.5.310.0090.04317.58
5.5.300.0150.04017.50
5.5.290.0100.03017.51
5.5.280.0040.02917.55
5.5.270.0080.03117.68
5.5.260.0100.03717.50
5.5.250.0030.04817.56
5.5.240.0080.04017.22
5.5.230.0050.02217.12
5.5.220.0060.03917.19
5.5.210.0080.04217.22
5.5.200.0050.04617.15
5.5.190.0060.04117.17
5.5.180.0100.03817.22
5.5.170.0070.00314.43
5.5.160.0060.04017.31
5.5.150.0100.03817.27
5.5.140.0070.04117.25
5.5.130.0050.04717.33
5.5.120.0000.04717.33
5.5.110.0120.03617.22
5.5.100.0080.04116.98
5.5.90.0030.03217.26
5.5.80.0100.03517.12
5.5.70.0050.02617.22
5.5.60.0040.04417.10
5.5.50.0090.02217.13
5.5.40.0020.04817.13
5.5.30.0080.03817.22
5.5.20.0090.03916.97
5.5.10.0080.04017.20
5.5.00.0060.03617.23
5.4.450.0060.04315.44
5.4.440.0020.02715.21
5.4.430.0080.03015.43
5.4.420.0050.02715.12
5.4.410.0060.03115.16
5.4.400.0030.03215.05
5.4.390.0020.03515.07
5.4.380.0050.03715.17
5.4.370.0100.03814.95
5.4.360.0050.04515.16
5.4.350.0070.03915.06
5.4.340.0100.03515.07
5.4.330.0030.00911.09
5.4.320.0110.04114.85
5.4.310.0100.03715.03
5.4.300.0110.02214.92
5.4.290.0070.03515.09
5.4.280.0070.03514.84
5.4.270.0080.03815.02
5.4.260.0060.02414.97
5.4.250.0060.03315.04
5.4.240.0050.04315.00
5.4.230.0050.03915.09
5.4.220.0070.03615.12
5.4.210.0150.03215.01
5.4.200.0070.02914.95
5.4.190.0070.03215.09
5.4.180.0030.03115.17
5.4.170.0050.04615.11
5.4.160.0100.02815.00
5.4.150.0080.02615.02
5.4.140.0090.03813.52
5.4.130.0070.03513.72
5.4.120.0030.03513.86
5.4.110.0020.04213.82
5.4.100.0030.02513.85
5.4.90.0070.03813.70
5.4.80.0060.03913.73
5.4.70.0100.03513.70
5.4.60.0020.02313.76
5.4.50.0040.04013.75
5.4.40.0020.04013.68
5.4.30.0100.03313.56
5.4.20.0060.03813.71
5.4.10.0110.03213.78
5.4.00.0070.03613.42
5.3.290.0020.03512.74
5.3.280.0050.04312.57
5.3.270.0060.02312.72
5.3.260.0080.04012.61
5.3.250.0080.03912.62
5.3.240.0050.04212.52
5.3.230.0060.03512.61
5.3.220.0070.03012.60
5.3.210.0070.03412.56
5.3.200.0030.04212.51
5.3.190.0020.04612.60
5.3.180.0030.02712.61
5.3.170.0030.02312.70
5.3.160.0030.02212.74
5.3.150.0020.02712.69
5.3.140.0070.03712.63
5.3.130.0070.04012.50
5.3.120.0080.03912.62
5.3.110.0050.03512.68
5.3.100.0050.02512.45
5.3.90.0100.03412.43
5.3.80.0150.02612.29
5.3.70.0050.03812.32
5.3.60.0120.03612.37
5.3.50.0090.03912.31
5.3.40.0060.02112.37
5.3.30.0030.02312.27
5.3.20.0010.04412.21
5.3.10.0020.04212.11
5.3.00.0030.03012.07
5.2.170.0130.05311.30
5.2.160.0070.05311.06
5.2.150.0030.04311.26
5.2.140.0100.04011.06
5.2.130.0100.05310.97
5.2.120.0070.06011.23
5.2.110.0100.05311.04
5.2.100.0100.04011.13
5.2.90.0070.04011.07
5.2.80.0130.05011.16
5.2.70.0130.05311.04
5.2.60.0070.06011.11
5.2.50.0030.05010.98
5.2.40.0000.05711.10
5.2.30.0170.04010.85
5.2.20.0000.05710.96
5.2.10.0070.05710.78
5.2.00.0030.05010.82
5.1.60.0070.05010.05
5.1.50.0070.04710.07
5.1.40.0070.05010.00
5.1.30.0100.04710.30
5.1.20.0100.04710.36
5.1.10.0000.04310.09
5.1.00.0030.03010.12
5.0.50.0100.0408.55
5.0.40.0030.0338.52
5.0.30.0030.0608.32
5.0.20.0030.0438.30
5.0.10.0030.0308.30
5.0.00.0030.0608.16
4.4.90.0100.0307.35
4.4.80.0070.0337.35
4.4.70.0030.0207.35
4.4.60.0070.0207.35
4.4.50.0030.0337.35
4.4.40.0070.0407.35
4.4.30.0000.0377.35
4.4.20.0030.0237.35
4.4.10.0000.0337.35
4.4.00.0030.0537.35
4.3.110.0000.0377.35
4.3.100.0030.0337.35
4.3.90.0000.0377.35
4.3.80.0100.0437.35
4.3.70.0000.0237.35
4.3.60.0030.0177.35
4.3.50.0000.0207.35
4.3.40.0070.0507.35
4.3.30.0000.0277.35
4.3.20.0030.0337.35
4.3.10.0000.0377.35
4.3.00.0000.0377.35

preferences:
40.87 ms | 400 KiB | 5 Q