3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'The dog ate the cat and the dog ate the chimp'; $find = 'dog'; $array = ['duck', 'pig']; $count = 1; while ($array && $count) { $string = preg_replace("#$find#", array_shift($array), $string, 1, $count); } echo $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)
8.5.30.0130.00621.13
8.5.20.0110.00620.07
8.5.10.0100.00916.89
8.5.00.0130.00822.09
8.4.180.0150.00622.06
8.4.170.0130.00923.88
8.4.160.0140.00923.83
8.4.150.0070.00616.95
8.4.140.0120.01218.05
8.4.130.0090.01017.63
8.4.120.0100.01020.43
8.4.110.0110.00522.32
8.4.100.0100.00817.85
8.4.90.0090.01117.79
8.4.80.0080.00918.04
8.4.70.0110.00817.93
8.4.60.0100.01118.73
8.4.50.0120.00719.64
8.4.40.0060.01317.74
8.4.30.0000.01920.70
8.4.20.0040.00421.70
8.4.10.0040.00419.80
8.3.300.0110.00820.93
8.3.290.0130.00718.72
8.3.280.0080.00816.78
8.3.270.0100.01016.43
8.3.260.0100.00816.81
8.3.250.0120.00719.04
8.3.240.0130.00716.51
8.3.230.0040.00416.47
8.3.220.0080.01218.88
8.3.210.0060.00216.65
8.3.200.0050.00416.54
8.3.190.0040.00417.27
8.3.180.0120.00716.96
8.3.170.0140.00320.87
8.3.160.0080.00017.21
8.3.150.0090.00617.04
8.3.140.0000.00917.18
8.3.130.0080.00018.56
8.3.120.0000.00918.96
8.3.110.0040.00818.66
8.3.100.0370.01137.54
8.3.90.0350.01237.54
8.3.80.0330.00737.54
8.3.70.0320.01337.54
8.3.60.0440.00437.54
8.3.50.0430.00037.54
8.3.40.0210.02137.54
8.3.30.0310.00337.54
8.3.20.0360.00437.54
8.3.10.0250.01037.54
8.3.00.0290.00337.54
8.2.300.0090.01118.76
8.2.290.0120.00720.43
8.2.280.0060.00818.47
8.2.270.0150.00316.46
8.2.260.0060.00318.47
8.2.250.0050.00316.45
8.2.240.0120.00817.39
8.2.230.0100.01020.94
8.2.220.0260.01037.54
8.2.210.0310.00437.54
8.2.200.0330.00937.54
8.2.190.0280.00837.54
8.2.180.0330.00837.54
8.2.170.0370.00737.54
8.2.160.0410.00337.54
8.2.150.0280.01637.54
8.2.140.0370.00737.54
8.2.130.0380.00637.54
8.2.120.0340.01037.54
8.2.110.0410.00337.54
8.2.100.0390.00437.54
8.2.90.0470.00437.54
8.2.80.0370.00737.54
8.2.70.0340.00737.54
8.2.60.0320.01237.54
8.2.50.0360.00337.54
8.2.40.0270.00737.54
8.2.30.0200.02037.54
8.2.20.0280.00737.54
8.2.10.0320.00937.54
8.2.00.0330.00737.54
8.1.340.0100.01117.94
8.1.330.0060.00518.20
8.1.320.0060.00416.20
8.1.310.0040.00418.07
8.1.300.0160.00316.44
8.1.290.0380.01237.54
8.1.280.0380.00337.54
8.1.270.0260.01337.54
8.1.260.0270.01737.54
8.1.250.0330.01137.54
8.1.240.0300.01237.54
8.1.230.0210.01437.54
8.1.220.0210.01037.54
8.1.210.0310.00837.54
8.1.200.0360.00337.54
8.1.190.0240.00937.54
8.1.180.0260.01337.54
8.1.170.0310.00837.54
8.1.160.0350.00437.54
8.1.150.0260.01337.54
8.1.140.0260.01337.54
8.1.130.0320.00737.54
8.1.120.0260.01337.54
8.1.110.0310.00837.54
8.1.100.0360.01237.54
8.1.90.0250.01137.54
8.1.80.0260.00737.54
8.1.70.0300.00637.54
8.1.60.0340.00837.54
8.1.50.0340.00737.54
8.1.40.0390.00037.54
8.1.30.0330.00337.54
8.1.20.0220.00637.54
8.1.10.0180.00337.54
8.1.00.0300.00737.54

preferences:
69.1 ms | 984 KiB | 5 Q