3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "Welcome to [city]. I want [city] to be a random version each time. [city] should not be the same [city] each time."; $keyword = "[city]"; $values = ["Orlando", "Dallas", "Atlanta", "Detroit", "Tampa", "Miami"]; shuffle($values); echo preg_replace_callback( '/' . preg_quote($keyword) . '/', function() use(&$values) { return array_pop($values); }, $text );

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.1.60.0060.00317.61
8.1.50.0030.00617.55
8.1.40.0070.00017.67
8.1.30.0090.00017.67
8.1.20.0050.00917.68
8.1.10.0090.00617.65
8.1.00.0130.00417.49
8.0.190.0130.00816.93
8.0.180.0120.00917.07
8.0.170.0120.00817.09
8.0.160.0220.00017.01
8.0.150.0190.00016.97
8.0.140.0050.00916.90
8.0.130.0060.01016.84
8.0.120.0080.00617.00
8.0.110.0090.00617.00
8.0.100.0090.00516.88
8.0.90.0060.00616.98
8.0.80.0080.00516.96
8.0.70.0070.00716.98
8.0.60.0130.00116.98
8.0.50.0080.00617.02
8.0.30.0070.00616.96
8.0.20.0100.00417.06
8.0.10.0080.00717.13
7.4.290.0160.00616.78
7.4.280.0240.00016.80
7.4.270.0100.00516.69
7.4.260.0090.00716.79
7.4.250.0090.00616.71
7.4.240.0090.00516.69
7.4.230.0090.00716.70
7.4.220.0120.00216.74
7.4.210.0110.00316.77
7.4.200.0060.00816.70
7.4.190.0090.00516.80
7.4.180.0090.00516.80
7.4.160.0090.00516.83
7.4.150.0110.00216.64
7.4.140.0090.00616.78
7.4.130.0100.00416.74
7.4.120.0080.00616.75
7.4.110.0090.00316.65
7.4.100.0030.00916.75
7.4.90.0060.00616.70
7.4.80.0060.00416.70
7.4.70.0020.00716.49
7.4.60.0090.00316.58
7.4.50.0060.00716.71
7.4.40.0110.00216.62
7.4.30.0050.00616.69
7.4.20.0060.00516.71
7.4.10.0060.00516.56
7.4.00.0040.00716.63
7.3.240.0040.00516.38

preferences:
39.55 ms | 403 KiB | 5 Q