3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sentence = '{Please|Just} make this {cool|awesome|random} test sentence {rotate {quickly|{fast|slow}} and random|spin and be random}'; $sentences = []; for($i = 0; $i < 20; $i++) { $sentences[] = sentence_spinning($sentence); } var_dump(array_values(array_unique($sentences))); function sentence_spinning($str) { do { $str = preg_replace_callback('#\{([^{}]*)\}#', function($matches) { return explode('|', $matches[1])[mt_rand(0, substr_count($matches[1], '|'))]; }, $str, -1, $count); } while ($count !== 0); return $str; }

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.120.0060.00915.04
7.3.110.0020.01415.21
7.3.100.0040.01415.10
7.3.90.0060.01015.07
7.3.80.0000.01514.99
7.3.70.0030.01415.12
7.3.60.0070.01014.89
7.3.50.0000.01314.91
7.3.40.0040.01414.96
7.3.30.0160.00015.11
7.3.20.0040.01116.85
7.3.10.0050.01116.75
7.3.00.0020.00916.64
7.2.240.0000.01415.05
7.2.230.0100.00715.16
7.2.220.0040.01515.18
7.2.210.0090.00615.00
7.2.200.0040.01215.18
7.2.190.0090.00615.14
7.2.180.0120.00415.13
7.2.170.0060.01015.30
7.2.160.0070.01015.11
7.2.150.0090.00617.11
7.2.140.0080.00816.99
7.2.130.0120.00516.80
7.2.120.0050.01116.70
7.2.110.0050.01217.04
7.2.100.0110.00716.85
7.2.90.0080.00816.87
7.2.80.0100.00916.91
7.2.70.0130.00516.94
7.2.60.0090.00717.05
7.2.50.0060.01017.09
7.2.40.0110.00617.17
7.2.30.0130.00416.97
7.2.20.0060.01216.96
7.2.10.0040.01116.86
7.2.00.0100.00916.94
7.1.330.0000.01615.68
7.1.320.0060.00915.95
7.1.310.0030.00915.98
7.1.300.0070.00716.04
7.1.290.0070.01016.15
7.1.280.0040.00815.68
7.1.270.0030.01216.07
7.1.260.0110.00416.07
7.1.250.0080.00815.88
7.1.70.0050.00317.46
7.1.60.0070.00719.82
7.1.50.0070.01617.23
7.1.00.0070.04722.30
7.0.200.0080.00316.71
7.0.140.0000.07722.02
7.0.60.0100.06719.95
7.0.50.0000.06718.01
7.0.40.0030.07020.22
7.0.30.0370.04720.14
7.0.20.0270.05720.40
7.0.10.0100.07720.34
7.0.00.0130.07020.24
5.6.280.0070.07021.02
5.6.210.0130.06720.73
5.6.200.0070.08318.34
5.6.190.0100.08320.50
5.6.180.0200.08320.50
5.6.170.0270.04320.50
5.6.160.0100.03320.61
5.6.150.0100.05018.25
5.6.140.0130.07018.23
5.6.130.0030.04018.11
5.6.120.0070.04021.00
5.6.110.0170.07721.02
5.6.100.0070.07020.96
5.6.90.0100.08020.95
5.6.80.0130.08020.45
5.5.350.0070.05320.45
5.5.340.0030.07718.04
5.5.330.0100.04020.27
5.5.320.0000.04720.30
5.5.310.0270.07720.30
5.5.300.0030.06318.05
5.5.290.0030.04017.95
5.5.280.0070.04020.88
5.5.270.0070.05720.68
5.5.260.0170.06720.87
5.5.250.0070.09320.77
5.5.240.0300.06720.18
5.4.450.0370.04319.64
5.4.440.0670.04019.33
5.4.430.0930.06719.54
5.4.420.0070.08019.55
5.4.410.0100.05319.32
5.4.400.0100.05319.06
5.4.390.0030.06019.16
5.4.380.0100.05319.16
5.4.370.0100.05019.07
5.4.360.0100.05319.12
5.4.350.0060.03712.03
5.4.340.0090.03912.03
5.4.320.0100.04112.51
5.4.310.0050.04512.50
5.4.300.0110.04012.51
5.4.290.0060.04012.51
5.4.280.0040.03512.41
5.4.270.0090.03712.41
5.4.260.0030.03912.41
5.4.250.0100.06018.97
5.4.240.0100.04718.81
5.4.230.0030.06319.00
5.4.220.0030.05718.89
5.4.210.0030.05718.96
5.4.200.0000.08018.96
5.4.190.0070.05318.75
5.4.180.0100.04719.05
5.4.170.0070.05318.72
5.4.160.0030.05318.91
5.4.150.0100.05318.95
5.4.140.0200.03716.41
5.4.130.0070.04716.50
5.4.120.0030.05316.64
5.4.110.0170.06316.67
5.4.100.0100.05016.58
5.4.90.0030.05316.39
5.4.80.0130.04316.66
5.4.70.0000.05316.43
5.4.60.0070.05316.50
5.4.50.0030.05016.51
5.4.40.0030.07016.61
5.4.30.0000.05316.41
5.4.20.0170.04016.53
5.4.10.0100.04716.45
5.4.00.0170.03715.84
5.3.290.0100.03712.80
5.3.280.0130.04314.68
5.3.270.0000.05714.62
5.3.260.0100.05014.76
5.3.250.0030.05314.47
5.3.240.0070.05014.62
5.3.230.0000.05714.62
5.3.220.0030.05314.44
5.3.210.0030.05314.48
5.3.200.0030.05314.45
5.3.190.0200.05314.60
5.3.180.0000.05314.41
5.3.170.0070.05014.27
5.3.160.0100.05014.57
5.3.150.0030.06014.57
5.3.140.0030.05314.61
5.3.130.0170.04314.49
5.3.120.0070.06314.55
5.3.110.0070.05014.70
5.3.100.0000.05714.09
5.3.90.0030.05014.04
5.3.80.0030.05013.96
5.3.70.0030.05314.11
5.3.60.0070.04713.78
5.3.50.0070.04713.98
5.3.40.0030.05013.95
5.3.30.0100.04313.77
5.3.20.0100.04713.56
5.3.10.0070.04713.66
5.3.00.0030.05013.56
5.2.170.0000.04311.14
5.2.160.0030.04011.29
5.2.150.0000.05011.15
5.2.140.0030.04311.05
5.2.130.0070.03710.98
5.2.120.0070.03711.07
5.2.110.0070.03711.04
5.2.100.0030.03711.20
5.2.90.0030.04011.11
5.2.80.0030.04310.97
5.2.70.0030.04311.10
5.2.60.0130.03710.89
5.2.50.0070.04011.02
5.2.40.0000.04310.93
5.2.30.0030.04010.73
5.2.20.0070.03710.84
5.2.10.0000.04311.03
5.2.00.0070.03710.61
5.1.60.0070.04310.04
5.1.50.0070.04010.07
5.1.40.0100.0309.87
5.1.30.0070.03310.51
5.1.20.0100.03010.50
5.1.10.0030.0339.91
5.1.00.0070.0309.97
5.0.50.0130.0238.64
5.0.40.0030.0278.13
5.0.30.0000.0438.43
5.0.20.0100.0208.02
5.0.10.0070.0278.00
5.0.00.0070.0378.00
4.4.90.0030.0206.75
4.4.80.0000.0236.75
4.4.70.0000.0236.75
4.4.60.0000.0276.75
4.4.50.0000.0236.75
4.4.40.0000.0376.75
4.4.30.0100.0206.75
4.4.20.0070.0276.75
4.4.10.0100.0236.75
4.4.00.0030.0336.75
4.3.110.0070.0176.75
4.3.100.0000.0236.75
4.3.90.0070.0176.75
4.3.80.0000.0376.75
4.3.70.0070.0176.75
4.3.60.0070.0176.75
4.3.50.0030.0206.75
4.3.40.0030.0306.75
4.3.30.0000.0236.75
4.3.20.0000.0306.75
4.3.10.0000.0236.75
4.3.00.0000.04014.52

preferences:
45.99 ms | 401 KiB | 5 Q