3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "{three/fifteen/one hundred} this is the first random number, and this is the second, {two/four}"; echo preg_replace_callback('~\{([^{}]*)}~', function ($x) { return array_rand(array_flip(explode('/', $x[1]))); }, $str);

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.4.110.0180.00016.61
7.4.100.0120.00616.62
7.4.90.0150.00316.55
7.4.80.0160.00316.65
7.4.70.0160.00816.46
7.4.60.0140.00316.58
7.4.50.0110.00716.55
7.4.40.0120.00616.56
7.4.30.0000.01616.65
7.4.20.0040.01216.41
7.4.10.0050.01116.50
7.4.00.0090.00916.43
7.3.230.0090.00916.40
7.3.220.0130.00716.46
7.3.210.0160.01016.48
7.3.200.0180.00016.58
7.3.190.0120.01216.39
7.3.180.0110.00816.52
7.3.170.0070.01116.62
7.3.160.0130.00616.48
7.3.150.0090.00816.51
7.3.140.0070.01016.61
7.3.130.0100.00716.62
7.3.120.0180.00016.45
7.3.110.0070.01116.48
7.3.100.0060.01116.55
7.3.90.0090.00916.80
7.3.80.0110.00616.40
7.3.70.0040.01316.44
7.3.60.0000.01616.52
7.3.50.0100.00616.48
7.3.40.0060.02216.43
7.3.30.0120.00616.52
7.3.20.0120.00816.36
7.3.10.0080.00816.38
7.3.00.0070.01016.42
7.2.340.0130.00616.91
7.2.330.0090.00916.73
7.2.320.0110.00716.73
7.2.310.0100.01016.91
7.2.300.0100.01016.94
7.2.290.0140.00416.70
7.2.280.0100.00716.95
7.2.270.0090.00816.74
7.2.260.0030.01516.60
7.2.250.0090.01016.78
7.2.240.0130.00716.74
7.2.230.0030.01516.71
7.2.220.0130.00516.79
7.2.210.0110.00716.75
7.2.200.0100.00716.79
7.2.190.0130.00316.73
7.2.180.0040.01416.72
7.2.170.0130.00616.53
7.2.160.0040.01516.57
7.2.150.0130.00716.79
7.2.140.0040.01516.79
7.2.130.0040.01516.94
7.2.120.0090.00916.80
7.2.110.0110.00716.71
7.2.100.0130.00516.77
7.2.90.0100.01016.66
7.2.80.0170.00416.61
7.2.70.0090.01216.80
7.2.60.0100.01016.64
7.2.50.0200.00316.76
7.2.40.0110.00816.77
7.2.30.0050.01316.92
7.2.20.0080.01116.73
7.2.10.0130.00616.58
7.2.00.0380.00316.78

preferences:
37.32 ms | 403 KiB | 5 Q