3v4l.org

run code in 300+ PHP versions simultaneously
<?PHP /** * Spintax - A helper class to process Spintax strings. * @name Spintax * @author Jason Davis - http://www.codedevelopr.com/ */ class Spintax { public function process($text) { return preg_replace_callback( '/\{(((?>[^\{\}]+)|(?R))*)\}/x', array($this, 'replace'), $text ); } public function replace($text) { $text = $this->process($text[1]); $parts = explode('|', $text); return $parts[array_rand($parts)]; } } ?> <?PHP $spintax = new Spintax(); $string = '{Hello|Howdy|Hola} to you, {Mr.|Mrs.|Ms.} {Smith|Williams|Davis}!'; echo $spintax->process($string); ?>

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.10.0070.00716.91
7.3.00.0000.01116.79
7.2.130.0070.00717.18
7.2.120.0070.00717.13
7.2.110.0000.01017.14
7.2.100.0070.00416.86
7.2.90.0090.00617.26
7.2.80.0070.00317.21
7.2.70.0030.01217.23
7.2.60.0080.00817.23
7.2.50.0000.01017.09
7.2.40.0060.00916.87
7.2.30.0030.01417.16
7.2.20.0090.00616.84
7.2.10.0090.00617.08
7.2.00.0060.00818.19
7.1.250.0000.01516.20
7.1.70.0030.01017.42
7.1.60.0070.00717.20
7.1.50.0080.00817.32
7.1.40.0000.01216.93
7.1.30.0030.01016.71
7.1.20.0060.00616.73
7.1.10.0000.01016.95
7.1.00.0080.00417.04
7.0.200.0060.00617.08
7.0.190.0050.00517.03
7.0.180.0060.00316.58
7.0.170.0030.00716.41
7.0.160.0070.00316.76
7.0.150.0080.00416.41
7.0.140.0390.00615.09
7.0.130.0090.00516.73
7.0.120.0040.00816.75
7.0.110.0060.00616.67
7.0.100.0050.00716.61
7.0.90.0000.01216.60
7.0.80.0120.01016.46
7.0.70.0150.00716.79
7.0.60.0220.00316.55
7.0.50.0140.01016.50
7.0.40.0000.00915.09
7.0.30.0000.01015.09
7.0.20.0000.00815.09
7.0.10.0030.00915.09
7.0.00.0030.00815.09
5.6.300.0040.05320.82
5.6.290.0070.04320.80
5.6.280.0040.04621.08
5.6.270.0070.04820.92
5.6.260.0000.06220.88
5.6.250.0030.05020.91
5.6.240.0070.04121.07
5.6.230.0030.04520.84
5.6.220.0060.04820.82
5.6.210.0130.03520.60
5.6.200.0000.05120.95
5.6.190.0070.04421.04
5.6.180.0030.04320.84
5.6.170.0070.04620.93
5.6.160.0070.04321.00
5.6.150.0100.04820.83
5.6.140.0100.04420.93
5.6.130.0040.04620.73
5.6.120.0070.04620.74
5.6.110.0130.03920.82
5.6.100.0040.04720.71
5.6.90.0070.05220.81
5.6.80.0100.03620.32
5.6.70.0160.03120.41
5.6.60.0060.04520.42
5.6.50.0120.03420.42
5.6.40.0090.04020.07
5.6.30.0000.05220.39
5.6.20.0060.04720.20
5.6.10.0100.03920.09
5.6.00.0030.04320.17
5.5.380.0120.03617.54
5.5.370.0040.04717.48
5.5.360.0030.04517.62
5.5.350.0000.04917.62
5.5.340.0100.03918.12
5.5.330.0000.04418.17
5.5.320.0070.04318.03
5.5.310.0100.03818.05
5.5.300.0070.04118.09
5.5.290.0070.04417.70
5.5.280.0130.04818.12
5.5.270.0070.04418.08
5.5.260.0100.04118.16
5.5.250.0030.04117.52
5.5.240.0000.04717.43
5.5.230.0000.04817.50
5.5.220.0030.04017.23
5.5.210.0030.04117.43
5.5.200.0160.02917.48
5.5.190.0000.04917.45
5.5.180.0120.03417.45
5.5.160.0090.03817.09
5.5.150.0000.05117.44
5.5.140.0170.03017.36
5.5.130.0300.04017.34
5.5.120.0070.05017.52
5.5.110.0090.03517.53
5.5.100.0180.02517.00
5.5.90.0100.04017.25
5.5.80.0070.04017.36
5.5.70.0000.05217.29
5.5.60.0070.04017.33
5.5.50.0030.04517.34
5.5.40.0100.03317.09
5.5.30.0070.04317.40
5.5.20.0200.03017.09
5.5.10.0070.03816.98
5.5.00.0060.03916.97
5.4.450.0110.04119.30
5.4.440.0070.04319.26
5.4.430.0030.04119.29
5.4.420.0290.03219.39
5.4.410.0030.04819.42
5.4.400.0120.03019.11
5.4.390.0100.03518.98
5.4.380.0070.03618.89
5.4.370.0120.03419.05
5.4.360.0000.04719.14
5.4.350.0070.04018.94
5.4.340.0070.04018.98
5.4.320.0070.04219.07
5.4.310.0070.04619.07
5.4.300.0070.04418.96
5.4.290.0030.03819.19
5.4.280.0030.08318.93
5.4.270.0100.03618.94
5.4.260.0000.04319.14
5.4.250.0130.03319.09
5.4.240.0070.03919.09
5.4.230.0130.03518.97
5.4.220.0130.03819.04
5.4.210.0040.03919.17
5.4.200.0030.04219.04
5.4.190.0100.03219.21
5.4.180.0070.04119.07
5.4.170.0030.05019.19
5.4.160.0120.03419.08
5.4.150.0000.04518.95
5.4.140.0060.06416.52
5.4.130.0170.03616.58
5.4.120.0070.04216.75
5.4.110.0070.03916.58
5.4.100.0120.03516.76
5.4.90.0000.04516.69
5.4.80.0160.03416.69
5.4.70.0070.03816.74
5.4.60.0040.04016.71
5.4.50.0100.04216.46
5.4.40.0030.04316.77
5.4.30.0070.03616.67
5.4.20.0000.04016.45
5.4.10.0000.04616.46
5.4.00.0070.03615.89
5.3.290.0070.03915.09
5.3.280.0060.03915.09
5.3.270.0150.03615.09
5.3.260.0000.04615.09
5.3.250.0030.04615.09
5.3.240.0070.03615.09
5.3.230.0070.04115.09
5.3.220.0070.03515.09
5.3.210.0000.04315.09
5.3.200.0000.04115.09
5.3.190.0100.03215.09
5.3.180.0040.04015.09
5.3.170.0060.03815.09
5.3.160.0060.03515.09
5.3.150.0100.03415.09
5.3.140.0070.03615.09
5.3.130.0090.04115.09
5.3.120.0000.04315.09
5.3.110.0140.03115.09
5.3.100.0060.03715.09
5.3.90.0070.04015.09
5.3.80.0070.04515.09
5.3.70.0030.04015.09
5.3.60.0060.03615.09
5.3.50.0030.03815.09
5.3.40.0070.05915.09
5.3.30.0090.03515.09
5.3.20.0070.03515.09
5.3.10.0060.03415.09
5.3.00.0060.03415.09
5.2.170.0070.06115.09
5.2.160.0000.04815.09
5.2.150.0060.04215.09
5.2.140.0070.03615.09
5.2.130.0000.03915.09
5.2.120.0110.02215.09
5.2.110.0000.03515.09
5.2.100.0040.02915.09
5.2.90.0060.03215.09
5.2.80.0030.03215.09
5.2.70.0000.04115.09
5.2.60.0170.02015.09
5.2.50.0070.02915.09
5.2.40.0000.03415.09
5.2.30.0280.01715.09
5.2.20.0060.03015.09
5.2.10.0090.02515.09
5.2.00.0100.02515.09
5.1.60.0000.02715.09
5.1.50.0000.02915.09
5.1.40.0000.03015.09
5.1.30.0000.03015.09
5.1.20.0000.03015.09
5.1.10.0100.01915.09
5.1.00.0100.01915.09
5.0.50.0060.01915.09
5.0.40.0060.02315.09
5.0.30.0030.03115.09
5.0.20.0070.01715.09
5.0.10.0030.02015.09
5.0.00.0060.02915.09
4.4.90.0000.02415.09
4.4.80.0000.01915.09
4.4.70.0000.01815.09
4.4.60.0000.01915.09
4.4.50.0000.01815.09
4.4.40.0000.02615.09
4.4.30.0000.01815.09
4.4.20.0040.01915.09
4.4.10.0030.01415.09
4.4.00.0000.02615.09
4.3.110.0000.02115.09
4.3.100.0000.01815.09
4.3.90.0030.01615.09
4.3.80.0030.02415.09
4.3.70.0000.01915.09
4.3.60.0030.01615.09
4.3.50.0030.02115.09
4.3.40.0090.01815.09
4.3.30.0000.01815.09
4.3.20.0000.01715.09
4.3.10.0000.01715.09
4.3.00.0000.01815.09

preferences:
30.82 ms | 403 KiB | 5 Q