3v4l.org

run code in 300+ PHP versions simultaneously
<?php $i = 0; $cnt = 5000; $placeholders = ['{SEXY}' => 'shmexy', '{PEXY}' => 'HUEXY', '{AXY}' => 'EFFEXY', '{OFFER}' => 'hot', '{TREMBLE}' => 'dremble']; $text = '{OFFER}dgfhdfjhkhj{SEXY}sdgGDSGsdgGDSGsdgGDSGsdgGDSGsdgGDSG{PEXY}sdgGDSGsdgGDSGsdgGDSG{PEXY} sdgGDSGsdgGDSGsdgGDSGsdgGDSGsdgGDSG{PEXY}sdgGDSGsdgGDSGsdgGDSGsdgGDSG{AXY}sdgGDSGsdgGDSGsdgGDSGsdgGD SG{OFFER}sdgGDSGsdgGDSGsdgGDSG{PEXY}sdgGDSGsdgGDSGsdgGDSGsdgGDSG{AXY}{AXY}sdgGDSGsdgGDSGsdgGDSG{AXY} sdgGDSGsdgGDSGsdgGDSG{OFFER}sdgGDSGsdgGDSGsdgGDSG{OFFER}sdgGDSGsdgGDSGsdgGDSG{sexy}sdgGDSGsdgGDSGsdg GDSGsdgGDSGsdgGDSGsdgGDSG{SEXY}sdgGDSGsdgGDSGsdgGDSG{sexy}234regd{OFFER}fg{OFFEggR}{PEXY}{SEXY}DFhgh fSDGFsGs{TREMBLE}sdgGDSGsdgGDSGsdgGDSGsdgGDSGsdgGDSGsdgGDSGsdgGDSGsdgGDSG{SEXY}'; echo "====\n"; $before = microtime(true); while ($i < $cnt) { $text2 = preg_replace_callback( '|{[A-Z_]+}|', function ($matches) use ($placeholders) { return isset($placeholders[$matches[0]]) ? $placeholders[$matches[0]] : $matches[0]; }, $text ); ++$i; } $after = microtime(true); echo ($after - $before) . "\n" . $text2 . PHP_EOL; $before = microtime(true); while ($i < $cnt) { $text3 = str_replace(array_keys($placeholders), array_values($placeholders), $text); ++$i; } $after = microtime(true); echo ($after - $before) . "\n" . $text3 . 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.3.120.0050.04115.10
7.3.110.0080.03715.15
7.3.100.0050.04115.00
7.3.90.0070.04314.95
7.3.80.0060.03715.07
7.3.70.0100.04214.93
7.3.60.0030.04415.17
7.3.50.0030.04115.04
7.3.40.0020.04014.95
7.3.30.0050.04714.94
7.3.20.0070.03916.98
7.3.10.0030.04516.73
7.3.00.0060.03916.70
7.2.240.0120.04515.37
7.2.230.0050.05015.22
7.2.220.0060.05215.21
7.2.210.0060.05915.11
7.2.200.0050.04515.41
7.2.190.0080.04315.12
7.2.180.0080.04415.36
7.2.170.0070.04815.37
7.2.160.0030.05015.27
7.2.150.0050.05417.24
7.2.140.0030.04717.16
7.2.130.0060.04817.00
7.2.120.0070.04616.97
7.2.110.0070.04817.15
7.2.100.0070.04717.04
7.2.90.0100.04917.15
7.2.80.0090.04517.09
7.2.70.0140.04717.08
7.2.60.0060.04517.04
7.2.50.0090.04417.06
7.2.40.0100.04717.13
7.2.30.0080.04917.12
7.2.20.0100.04417.09
7.2.10.0100.04217.15
7.2.00.0050.04817.61
7.1.330.0050.06415.94
7.1.320.0070.05816.03
7.1.310.0050.05616.02
7.1.300.0050.06415.95
7.1.290.0080.05616.04
7.1.280.0080.05716.03
7.1.270.0030.06115.93
7.1.260.0080.06115.81
7.1.250.0070.06115.98
7.1.70.0030.03717.39
7.1.60.0000.04819.57
7.1.50.0070.06317.30
7.1.00.0070.12022.32
7.0.200.0030.05816.66
7.0.140.0000.11322.12
7.0.60.0030.13319.95
7.0.50.0030.09017.92
7.0.40.0030.11020.17
7.0.30.0230.07720.25
7.0.20.0270.08720.09
7.0.10.0100.12720.29
7.0.00.0100.11320.27
5.6.280.0000.16320.82
5.6.210.0100.15020.44
5.6.200.0000.10018.19
5.6.190.0270.09720.39
5.6.180.0130.13720.62
5.6.170.0300.13320.62
5.6.160.0070.16020.50
5.6.150.0200.14318.21
5.6.140.0000.16718.19
5.6.130.0100.14318.28
5.6.120.0100.16720.99
5.6.110.0070.15020.96
5.6.100.0070.14721.11
5.6.90.0000.16020.95
5.6.80.0000.09720.38
5.5.350.3970.10020.39
5.5.340.0030.13317.99
5.5.330.0100.09020.35
5.5.320.0300.14720.42
5.5.310.0170.09720.42
5.5.300.0070.09017.97
5.5.290.0170.15317.95
5.5.280.0170.15320.88
5.5.270.0070.10720.89
5.5.260.0200.13020.88
5.5.250.0170.13320.69
5.5.240.0100.15020.26
5.4.450.0070.15019.16
5.4.440.0870.14019.47
5.4.430.0170.13019.38
5.4.420.0170.15019.68
5.4.410.0070.14318.95
5.4.400.0100.14718.52
5.4.390.0130.15318.70
5.4.380.0100.13718.73
5.4.370.0100.10018.61
5.4.360.0100.11318.73
5.4.350.0100.09718.80
5.4.340.0100.09718.71
5.4.320.0070.10318.62
5.4.310.0170.09018.77
5.4.300.0070.10718.73
5.4.290.0030.10318.57
5.4.280.0070.11018.54
5.4.270.0130.11018.75
5.4.260.0000.12718.62
5.4.250.0130.16318.77
5.4.240.0170.15018.59
5.4.230.0070.09718.52
5.4.220.0130.09718.70
5.4.210.0070.09318.84
5.4.200.0100.10316.70
5.4.190.0130.11018.70
5.4.180.0170.10018.55
5.4.170.0170.10018.63
5.4.160.0100.14318.59
5.4.150.0170.12018.45
5.4.140.0230.14716.36
5.4.130.0170.14016.22
5.4.120.0030.10316.33
5.4.110.0170.09316.43
5.4.100.0070.10016.34
5.4.90.0100.09716.32
5.4.80.0070.10316.27
5.4.70.0100.10016.25
5.4.60.0030.11016.31
5.4.50.0130.12316.27
5.4.40.0070.14016.14
5.4.30.0130.11716.22
5.4.20.0030.10316.15
5.4.10.0030.10316.43
5.4.00.0000.11015.73
5.3.290.0100.03714.59
5.3.280.0100.03314.49
5.3.270.0130.03314.49
5.3.260.0030.04014.51
5.3.250.0070.04014.62
5.3.240.0030.05014.46
5.3.230.0070.04014.60
5.3.220.0030.04314.48
5.3.210.0130.03714.49
5.3.200.0030.04014.60
5.3.190.0130.04014.60
5.3.180.0070.03314.48
5.3.170.0000.04014.58
5.3.160.0070.03714.48
5.3.150.0000.04714.57
5.3.140.0100.03714.48
5.3.130.0030.04014.61
5.3.120.0100.03314.45
5.3.110.0070.03714.45
5.3.100.0100.03314.00
5.3.90.0100.03313.93
5.3.80.0130.03313.95
5.3.70.0100.03314.03
5.3.60.0070.03713.92
5.3.50.0030.04013.97
5.3.40.0100.03713.96
5.3.30.0100.03713.95
5.3.20.0030.04313.62
5.3.10.0130.03013.57
5.3.00.0130.03313.49
5.2.170.0000.03711.05
5.2.160.0030.03311.12
5.2.150.0030.03311.03
5.2.140.0070.03011.21
5.2.130.0100.02710.98
5.2.120.0100.02711.15
5.2.110.0070.02711.19
5.2.100.0070.02711.10
5.2.90.0100.02711.19
5.2.80.0030.03310.96
5.2.70.0130.03011.11
5.2.60.0070.03311.02
5.2.50.0030.03311.02
5.2.40.0030.03310.92
5.2.30.0070.04010.98
5.2.20.0000.04711.03
5.2.10.0000.03310.77
5.2.00.0070.03310.68
5.1.60.0000.03010.00
5.1.50.0030.0279.91
5.1.40.0100.03010.10
5.1.30.0170.02710.31
5.1.20.0130.02310.38
5.1.10.0070.03310.06
5.1.00.0130.03010.06
5.0.50.0030.0308.57
5.0.40.0100.0238.49
5.0.30.0030.0438.21
5.0.20.0070.0278.15
5.0.10.0070.0238.23
5.0.00.0170.0308.13
4.4.90.0030.0175.85
4.4.80.0070.0105.83
4.4.70.0070.0135.79
4.4.60.0000.0205.85
4.4.50.0000.0175.82
4.4.40.0070.0205.84
4.4.30.0000.0235.80
4.4.20.0000.0175.88
4.4.10.0030.0135.98
4.4.00.0000.0275.86
4.3.110.0030.0135.77
4.3.100.0000.0175.76
4.3.90.0000.0175.74
4.3.80.0030.0235.82
4.3.70.0000.0175.76
4.3.60.0070.0175.82
4.3.50.0030.0135.90
4.3.40.0030.0235.72
4.3.30.0000.0174.62
4.3.20.0000.0174.50
4.3.10.0000.0174.44
4.3.00.0130.0237.30

preferences:
70.84 ms | 403 KiB | 5 Q