3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Thesaurus { protected $synonyms = array( array('wonderful', 'great', 'amazing', 'fabulous'), array('look', 'see', 'observe') ); public function replace($word) { foreach ($this->synonyms as $synonym) { if (in_array($word, $synonym)) { return $synonym[ array_rand($synonym) ]; } } return $word; } } $thesaurus = new Thesaurus; $description = 'This is my wonderful description. It really is wonderful. Look how wonderful it is.'; foreach (str_word_count($description, 1) as $word) { $description = str_replace($word, $thesaurus->replace($word), $description); } echo $description, PHP_EOL;

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.2.00.0070.00719.51
7.1.70.0030.01617.29
7.1.60.0120.01219.70
7.1.50.0070.01716.98
7.1.00.0000.08022.48
7.0.200.0000.00716.96
7.0.140.0070.06722.09
7.0.60.0070.08019.87
7.0.50.0070.06717.91
7.0.40.0070.08317.77
7.0.30.0030.09017.75
7.0.20.0130.08017.71
7.0.10.0070.05717.72
7.0.00.0030.08317.80
5.6.280.0070.07020.90
5.6.210.0070.05020.70
5.6.200.0070.08018.18
5.6.190.0070.08018.27
5.6.180.0100.06018.19
5.6.170.0070.06018.16
5.6.160.0100.03718.25
5.6.150.0030.04318.29
5.6.140.0100.06018.28
5.6.130.0070.07018.16
5.6.120.0070.07718.18
5.6.110.0070.07718.26
5.6.100.0100.07718.14
5.6.90.0170.06718.16
5.6.80.0100.06317.63
5.6.70.0030.05317.66
5.6.60.0030.05317.52
5.6.50.0170.07017.60
5.6.40.0070.07717.47
5.6.30.0030.08017.63
5.6.20.0130.04317.60
5.6.10.0070.07317.59
5.6.00.0070.07317.49
5.5.350.4230.04020.48
5.5.340.0130.08018.02
5.5.330.0100.06717.94
5.5.320.0000.09017.97
5.5.310.0000.08717.98
5.5.300.0030.04317.95
5.5.290.0100.07317.95
5.5.280.0170.03718.07
5.5.270.0030.06018.00
5.5.260.0030.08317.91
5.5.250.0130.08017.79
5.5.240.0030.08017.36
5.5.230.0130.07317.32
5.5.220.0170.05717.33
5.5.210.0030.08317.32
5.5.200.0100.07717.38
5.5.190.0100.07717.33
5.5.180.0030.08717.31
5.5.160.0070.07717.43
5.5.150.0130.07317.29
5.5.140.0030.08017.33
5.5.130.0070.04017.30
5.5.120.0070.07317.32
5.5.110.0000.06017.30
5.5.100.0070.04717.27
5.5.90.0000.04317.23
5.5.80.0100.04317.28
5.5.70.0000.04317.28
5.5.60.0000.07717.23
5.5.50.0070.08017.19
5.5.40.0070.07717.23
5.5.30.0130.07017.23
5.5.20.0070.07717.33
5.5.10.0030.08017.18
5.5.00.0100.07717.27
5.4.450.0100.08019.38
5.4.440.0100.08319.42
5.4.430.0170.03719.34
5.4.420.0100.07319.36
5.4.410.0170.06319.46
5.4.400.0170.05019.07
5.4.390.0070.06018.88
5.4.380.0000.08318.89
5.4.370.0070.04319.01
5.4.360.0030.04019.02
5.4.350.0130.06719.03
5.4.340.0070.08019.02
5.4.320.0000.07019.13
5.4.310.0000.06019.27
5.4.300.0170.06719.05
5.4.290.0030.05019.12
5.4.280.0100.07019.09
5.4.270.0070.04718.98
5.4.260.0000.04718.95
5.4.250.0030.05319.09
5.4.240.0000.04019.04
5.4.230.0130.03719.02
5.4.220.0070.08019.05
5.4.210.0100.08018.98
5.4.200.0100.04019.05
5.4.190.0100.06019.04
5.4.180.0070.07719.08
5.4.170.0130.07019.04
5.4.160.0100.06319.03
5.4.150.0100.07319.03
5.4.140.0170.06316.58
5.4.130.0100.05716.38
5.4.120.0100.06716.46
5.4.110.0070.03716.42
5.4.100.0070.03716.48
5.4.90.0030.07316.29
5.4.80.0000.05016.47
5.4.70.0000.04016.32
5.4.60.0000.07716.28
5.4.50.0070.03316.35
5.4.40.0070.06316.34
5.4.30.0100.03716.56
5.4.20.0130.04716.51
5.4.10.0070.06016.50
5.4.00.0070.07315.84
5.3.290.0130.05014.71
5.3.280.0030.03714.70
5.3.270.0030.08314.64
5.3.260.0100.05714.66
5.3.250.0070.07314.65
5.3.240.0100.05314.63
5.3.230.0070.05714.63
5.3.220.0000.04014.61
5.3.210.0070.06314.62
5.3.200.0130.06714.60
5.3.190.0030.04014.53
5.3.180.0030.08014.52
5.3.170.0030.05014.61
5.3.160.0070.05314.55
5.3.150.0070.04314.67
5.3.140.0100.06314.41
5.3.130.0070.04714.60
5.3.120.0130.06714.60
5.3.110.0130.07014.59
5.3.100.0000.06014.07
5.3.90.0100.06714.04
5.3.80.0100.06014.02
5.3.70.0070.05314.04
5.3.60.0070.07314.04
5.3.50.0030.05013.98
5.3.40.0030.03713.80
5.3.30.0070.03713.86
5.3.20.0030.06713.60
5.3.10.0030.07313.54
5.3.00.0030.03713.65
5.2.170.0070.05311.18
5.2.160.0030.03311.16
5.2.150.0030.05711.00
5.2.140.0030.06711.12
5.2.130.0100.05710.95
5.2.120.0070.06311.15
5.2.110.0070.04710.96
5.2.100.0070.04311.00
5.2.90.0070.06011.05
5.2.80.0030.04011.14
5.2.70.0030.06711.30
5.2.60.0030.03011.08
5.2.50.0070.04311.02
5.2.40.0070.04711.06
5.2.30.0000.04310.96
5.2.20.0070.06310.96
5.2.10.0000.04710.91
5.2.00.0030.06310.76
5.1.60.0070.02710.05
5.1.50.0070.0439.97
5.1.40.0030.0379.89
5.1.30.0030.06010.39
5.1.20.0070.05710.32
5.1.10.0100.04310.04
5.1.00.0070.05710.12
5.0.50.0000.0508.52
5.0.40.0030.0478.34
5.0.30.0030.0478.22
5.0.20.0100.0338.26
5.0.10.0030.0438.11
5.0.00.0000.0678.22
4.4.90.0030.0377.69
4.4.80.0100.0237.69
4.4.70.0000.0377.69
4.4.60.0030.0237.69
4.4.50.0030.0377.69
4.4.40.0000.0607.69
4.4.30.0070.0337.69
4.4.20.0070.0337.69
4.4.10.0070.0337.69
4.4.00.0000.0577.69
4.3.110.0000.0307.69
4.3.100.0030.0337.69
4.3.90.0030.0207.69
4.3.80.0000.0437.69
4.3.70.0070.0137.69
4.3.60.0000.0377.69
4.3.50.0000.0407.69
4.3.40.0000.0477.69
4.3.30.0000.0377.69
4.3.20.0000.0277.69
4.3.10.0000.0337.69
4.3.00.0000.0207.69

preferences:
36.74 ms | 400 KiB | 5 Q