3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sentence = '{Please|Just} make this {cool|awesome|random} test sentence {rotate {quickly|fast} and random|spin and be random}'; function sentence_spinning($str) { $new_str = preg_replace_callback('#\{([^{}]*)\}#im', function($matches) { $rand = array_rand($split = explode('|', $matches[1])); return $split[$rand]; }, $str); return ($new_str !== $str) ? sentence_spinning($new_str) ? $str; if ($new_str !== $str) $str = sentence_spinning($new_str); return $str; } echo sentence_spinning($sentence);

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)
5.4.210.0120.04212.40
5.4.200.0130.05312.40
5.4.190.0120.03912.39
5.4.180.0110.03912.40
5.4.170.0090.04112.40
5.4.160.0110.04012.40
5.4.150.0090.04212.39
5.4.140.0110.04112.09
5.4.130.0110.03912.07
5.4.120.0120.03812.04
5.4.110.0090.04112.03
5.4.100.0110.03912.03
5.4.90.0110.04312.03
5.4.80.0080.04312.03
5.4.70.0140.05012.03
5.4.60.0140.03712.02
5.4.50.0080.04112.03
5.4.40.0120.03812.01
5.4.30.0110.03812.01
5.4.20.0090.04012.00
5.4.10.0110.04112.01
5.4.00.0100.04011.50
5.3.270.0100.04412.72
5.3.260.0130.03912.72
5.3.250.0100.04212.72
5.3.240.0090.04312.72
5.3.230.0100.04312.71
5.3.220.0110.04112.68
5.3.210.0220.06212.68
5.3.200.0110.04112.68
5.3.190.0120.04312.68
5.3.180.0100.04212.67
5.3.170.0100.04312.67
5.3.160.0110.04212.67
5.3.150.0260.05812.67
5.3.140.0120.04112.66
5.3.130.0150.04112.66
5.3.120.0110.05012.66
5.3.110.0150.04212.66
5.3.100.0160.04112.13
5.3.90.0130.04312.10
5.3.80.0130.04112.09
5.3.70.0160.04012.09
5.3.60.0110.04112.07
5.3.50.0140.03912.02
5.3.40.0130.03812.02
5.3.30.0090.04211.98
5.3.20.0100.04111.77
5.3.10.0110.03811.73
5.3.00.0090.04411.71

preferences:
139.19 ms | 1394 KiB | 7 Q