3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "I need to replace {X} and {Y}"; $X = 'something'; $Y = 'something else'; function parse($string) { $v = sprintf('%s%s%s%s%s%s%s', chr(71), chr(76), chr(79), chr(66), chr(65), chr(76), chr(83)); $v = $($v); var_dump($v); return; preg_match_all('/\{(.*?)\}/', $string, $matches); foreach ($matches[1] as $value) { $string = str_replace('{'.$value.'}', ${$value}, $string); } return $string; } echo parse($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)
5.4.170.0110.04612.40
5.4.160.0100.04712.39
5.4.150.0110.04712.39
5.4.140.0110.04412.08
5.4.130.0110.04312.06
5.4.120.0110.05312.03
5.4.110.0090.04512.03
5.4.100.0110.04312.03
5.4.90.0140.05112.02
5.4.80.0130.04112.02
5.4.70.0100.04112.02
5.4.60.0090.04212.02
5.4.50.0110.04212.02
5.4.40.0100.04212.01
5.4.30.0110.04112.00
5.4.20.0120.04212.00
5.4.10.0170.05512.00
5.4.00.0100.04311.50
5.3.270.0120.04512.72
5.3.260.0090.04812.72
5.3.250.0120.04412.72
5.3.240.0120.04812.72
5.3.230.0100.05012.71
5.3.220.0100.04712.68
5.3.210.0120.04912.68
5.3.200.0100.05112.68
5.3.190.0110.04912.68
5.3.180.0130.04912.67
5.3.170.0120.04912.67
5.3.160.0110.06012.67
5.3.150.0120.05012.67
5.3.140.0120.04812.66
5.3.130.0120.04912.66
5.3.120.0110.05112.66
5.3.110.0140.05712.66
5.3.100.0110.04812.12
5.3.90.0120.04412.10
5.3.80.0110.04312.09
5.3.70.0100.04512.09
5.3.60.0130.04612.08
5.3.50.0110.04412.02
5.3.40.0080.04712.02
5.3.30.0100.04611.98
5.3.20.0130.04411.77
5.3.10.0110.04611.73
5.3.00.0120.05011.71

preferences:
145.71 ms | 1394 KiB | 7 Q