3v4l.org

run code in 300+ PHP versions simultaneously
<?php function translatePronouns($text) { static $replacePairs = [ 'iyou' => ['i', 'you'], 'youi' => ['^you', 'i'], 'myyour' => ['my', 'your'], 'yourmy' => ['your', 'my'], 'meyou' => ['me', 'you'], 'youme' => ['you', 'me'], 'myselfyourself' => ['myself', 'yourself'], 'yourselfmyself' => ['yourself', 'myself'], 'mineyours' => ['mine', 'yours'], 'yoursmine' => ['yours', 'mine'], ]; static $expr; if (!isset($expr)) { $parts = []; foreach ($replacePairs as $name => $pair) { $parts[] = "(?<=^|\s)(?P<$name>$pair[0])(?=$|\s)"; } $expr = '#' . implode('|', $parts) . '#i'; } return preg_replace_callback($expr, function($match) use($replacePairs) { foreach ($match as $name => $text) { if ($text !== '' && isset($replacePairs[$name])) { return $replacePairs[$name][1]; } } // var_dump($match); //return $replacePairs[$match[0]]; }, $text); } $strings = [ 'i should go fuck myself', 'i will kill you if i decide it suits me to do so', 'you will eat me', 'my boobs are bigger than yours' ]; foreach ($strings as $string) { echo translatePronouns($string) . "\n"; }

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.4.140.0100.01117.78
8.4.130.0090.01118.78
8.4.120.0130.00820.10
8.4.110.0180.00224.01
8.4.100.0120.00618.09
8.4.90.0120.00920.50
8.4.80.0160.00418.90
8.4.70.0080.00918.96
8.4.60.0080.00922.67
8.4.50.0130.00718.73
8.4.40.0140.00721.37
8.4.30.0100.01017.92
8.4.20.0170.00317.96
8.4.10.0060.01020.47
8.3.260.0110.00716.88
8.3.250.0110.00916.74
8.3.240.0100.01116.90
8.3.230.0110.00916.80
8.3.220.0130.00619.07
8.3.210.0110.00816.88
8.3.200.0070.00416.73
8.3.190.0100.00917.15
8.3.180.0110.00719.29
8.3.170.0130.00717.50
8.3.160.0040.00418.77
8.3.150.0120.00616.91
8.3.140.0000.00817.16
8.3.130.0130.00618.48
8.3.120.0060.00320.75
8.3.110.0100.00020.94
8.3.100.0100.00017.04
8.3.90.0090.00626.77
8.3.80.0060.00318.45
8.3.70.0160.00616.63
8.3.60.0110.00417.13
8.3.50.0070.01322.23
8.3.40.0110.00419.00
8.3.30.0070.00719.14
8.3.20.0030.00519.27
8.3.10.0050.00323.61
8.3.00.0030.00520.69
8.2.290.0070.00216.68
8.2.280.0080.00220.17
8.2.270.0090.00916.96
8.2.260.0120.00317.18
8.2.250.0060.00918.91
8.2.240.0000.00919.09
8.2.230.0090.00022.58
8.2.220.0060.00324.06
8.2.210.0000.00826.77
8.2.200.0030.00618.79
8.2.190.0070.01316.75
8.2.180.0130.00325.92
8.2.170.0120.00322.96
8.2.160.0070.01119.09
8.2.150.0070.00025.66
8.2.140.0050.00324.66
8.2.130.0000.00826.16
8.2.120.0080.00021.22
8.2.110.0030.00622.20
8.2.100.0110.00018.09
8.2.90.0040.00418.22
8.2.80.0040.00417.97
8.2.70.0060.00317.88
8.2.60.0090.00018.05
8.2.50.0030.00618.07
8.2.40.0040.00418.22
8.2.30.0040.00418.25
8.2.20.0000.00717.90
8.2.10.0040.00418.17
8.2.00.0030.00918.24
8.1.330.0140.00616.46
8.1.320.0130.00716.41
8.1.310.0030.00518.34
8.1.300.0060.00918.28
8.1.290.0080.00430.84
8.1.280.0100.00725.92
8.1.270.0040.00423.84
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0140.00422.77
8.1.230.0090.00321.16
8.1.220.0050.00317.78
8.1.210.0040.00419.09
8.1.200.0030.00617.60
8.1.190.0090.00317.38
8.1.180.0000.00818.10
8.1.170.0050.00319.04
8.1.160.0000.00919.02
8.1.150.0040.00418.98
8.1.140.0090.00019.64
8.1.130.0000.00817.86
8.1.120.0000.00817.70
8.1.110.0040.00417.66
8.1.100.0000.00717.63
8.1.90.0000.00717.66
8.1.80.0030.00617.63
8.1.70.0080.00017.67
8.1.60.0030.00517.76
8.1.50.0040.00417.73
8.1.40.0050.00317.79
8.1.30.0080.00017.86
8.1.20.0030.00517.77
8.1.10.0000.00917.68
8.1.00.0040.00417.72
8.0.300.0000.00820.02
8.0.290.0000.00817.00
8.0.280.0040.00418.44
8.0.270.0070.00017.35
8.0.260.0030.00317.35
8.0.250.0000.00717.20
8.0.240.0030.00317.12
8.0.230.0030.00317.19
8.0.220.0030.00517.09
8.0.210.0040.00717.05
8.0.200.0000.00717.13
8.0.190.0030.00517.03
8.0.180.0000.00717.13
8.0.170.0090.00016.99
8.0.160.0040.00417.12
8.0.150.0020.00517.01
8.0.140.0040.00417.05
8.0.130.0030.00313.49
8.0.120.0050.00316.95
8.0.110.0000.00716.91
8.0.100.0040.00417.07
8.0.90.0000.00717.04
8.0.80.0130.01017.09
8.0.70.0080.00017.19
8.0.60.0070.00016.93
8.0.50.0000.00817.09
8.0.30.0100.00717.40
8.0.20.0160.00417.40
8.0.10.0020.00517.29
8.0.00.0070.01017.15
7.4.330.0000.00515.13
7.4.320.0030.00516.79
7.4.300.0000.00616.72
7.4.290.0000.00716.66
7.4.280.0030.00616.73
7.4.270.0000.00716.78
7.4.260.0030.00416.75
7.4.250.0000.00716.64
7.4.240.0000.00716.78
7.4.230.0000.00716.90
7.4.220.0130.01316.77
7.4.210.0050.00916.75
7.4.200.0000.00716.90
7.4.160.0090.00716.76
7.4.150.0140.00417.40
7.4.140.0080.01017.86
7.4.130.0080.01116.57
7.4.120.0120.00616.78
7.4.110.0030.01416.90
7.4.100.0000.01916.85
7.4.90.0040.01316.89
7.4.80.0030.01319.39
7.4.70.0100.00716.70
7.4.60.0030.01417.11
7.4.50.0050.00916.71
7.4.40.0060.01316.68
7.4.30.0090.00916.91
7.4.00.0060.01015.04
7.3.330.0030.00313.35
7.3.320.0030.00313.50
7.3.310.0050.00516.45
7.3.300.0000.00716.44
7.3.290.0030.00316.53
7.3.280.0110.00816.55
7.3.270.0130.00617.40
7.3.260.0100.01116.75
7.3.250.0110.01116.60
7.3.240.0090.01016.74
7.3.230.0130.00716.65
7.3.210.0070.01416.66
7.3.200.0140.00316.65
7.3.190.0080.00816.91
7.3.180.0060.01016.53
7.3.170.0090.00916.64
7.3.160.0070.01016.76
7.3.120.0060.00615.07
7.3.110.0000.01315.00
7.3.100.0060.00915.35
7.3.90.0100.00715.00
7.3.80.0110.00315.32
7.3.70.0120.00415.02
7.3.60.0000.01815.23
7.3.50.0030.01115.18
7.3.40.0090.00314.99
7.3.30.0070.01015.00
7.3.20.0030.01016.80
7.3.10.0050.01016.90
7.3.00.0090.00616.75
7.2.330.0070.01016.97
7.2.320.0060.01716.80
7.2.310.0120.01216.94
7.2.300.0070.01017.05
7.2.290.0110.00716.95
7.2.240.0090.00615.45
7.2.230.0040.00715.45
7.2.220.0000.01415.21
7.2.210.0110.00715.07
7.2.200.0040.01115.09
7.2.190.0070.01015.14
7.2.180.0040.01115.22
7.2.170.0100.00315.24
7.2.160.0030.01115.46
7.2.150.0030.01017.07
7.2.140.0040.01117.22
7.2.130.0050.01016.91
7.2.120.0020.01217.02
7.2.110.0030.01317.12
7.2.100.0060.00917.26
7.2.90.0030.01217.07
7.2.80.0060.00917.21
7.2.70.0070.00717.11
7.2.60.0050.00817.01
7.2.50.0060.01017.18
7.2.40.0050.00717.26
7.2.30.0020.01217.17
7.2.20.0080.00817.27
7.2.10.0000.01617.20
7.2.00.0040.00917.88
7.1.330.0080.00815.98
7.1.320.0030.01416.00
7.1.310.0060.00615.97
7.1.300.0070.00716.20
7.1.290.0030.00716.09
7.1.280.0100.00315.94
7.1.270.0040.01116.21
7.1.260.0000.01216.07
7.1.250.0050.00815.90
7.1.200.0070.00715.82
7.1.70.0060.00917.36
7.1.60.0110.00519.81
7.1.00.0030.07722.51
7.0.200.0220.00614.96
7.0.100.0070.06320.07
7.0.90.0100.06019.98
7.0.80.0070.06320.11
7.0.70.0100.06020.07
7.0.60.0070.06320.00
7.0.50.0230.04720.32
7.0.40.0070.06020.22
7.0.30.0100.06020.33
7.0.20.0130.05320.39
7.0.10.0100.06020.35
7.0.00.0230.05320.47
5.6.250.0230.04720.55
5.6.240.0100.06320.65
5.6.230.0230.05720.76
5.6.220.0070.06020.77
5.6.210.0100.05720.71
5.6.200.0170.06021.11
5.6.190.0100.06021.10
5.6.180.0070.06021.11
5.6.170.0130.05321.19
5.6.160.0030.09021.14
5.6.150.0230.07021.12
5.6.140.0100.06021.11
5.6.130.0230.04721.11
5.6.120.0030.06321.08
5.6.110.0130.05721.21
5.6.100.0070.06021.03
5.6.90.0100.06321.18
5.6.80.0130.05020.51
5.6.70.0070.06020.46
5.6.60.0100.05320.48
5.6.50.0230.04020.50
5.6.40.0130.05320.40
5.6.30.0200.04320.49
5.6.20.0070.06020.44
5.6.10.0130.05020.56
5.6.00.0100.05320.44

preferences:
35.91 ms | 403 KiB | 5 Q