3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'try replacing {foo} and {huh} and {bar} in text'; $data_array = [ 'foo' => 'fighters', 'bar' => 'snacks', ]; echo preg_replace_callback( '/{(\w+)}/', fn($m) => $data_array[$m[1]] ?? $m[0], $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.00.0100.01420.45
8.4.150.0030.00014.05
8.4.140.0100.01217.93
8.4.130.0090.01122.27
8.4.120.0140.00320.77
8.4.110.0120.00822.55
8.4.100.0150.00618.20
8.4.90.0110.00920.55
8.4.80.0060.00418.12
8.4.70.0120.01118.22
8.4.60.0120.00818.77
8.4.50.0090.00618.91
8.4.40.0100.01018.51
8.4.30.0070.00318.82
8.4.20.0070.01417.79
8.4.10.0040.01519.68
8.3.280.0140.00618.64
8.3.270.0020.00816.70
8.3.260.0100.01016.63
8.3.250.0040.00418.87
8.3.240.0070.00616.99
8.3.230.0070.00716.88
8.3.220.0080.01017.19
8.3.210.0060.00918.46
8.3.200.0050.00416.59
8.3.190.0120.00717.19
8.3.180.0090.01016.75
8.3.170.0120.00618.65
8.3.160.0090.00918.60
8.3.150.0050.00320.68
8.3.140.0080.00817.20
8.3.130.0050.00318.53
8.3.120.0030.00620.65
8.3.110.0060.00316.55
8.3.100.0070.00316.78
8.3.90.0110.00726.77
8.3.80.0060.00317.97
8.3.70.0110.00718.20
8.3.60.0140.00716.63
8.3.50.0140.00416.60
8.3.40.0130.00722.05
8.3.30.0100.00321.94
8.3.20.0070.00024.18
8.3.10.0040.00424.66
8.3.00.0070.00026.16
8.2.290.0100.00020.66
8.2.280.0100.00718.61
8.2.270.0040.01417.45
8.2.260.0130.00718.48
8.2.250.0030.00519.11
8.2.240.0030.01317.43
8.2.230.0050.00320.94
8.2.220.0030.00724.06
8.2.210.0040.00426.77
8.2.200.0060.00316.88
8.2.190.0160.00616.58
8.2.180.0110.00716.75
8.2.170.0090.00619.10
8.2.160.0070.00722.96
8.2.150.0040.00425.66
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0060.00320.88
8.2.110.0060.01220.40
8.2.100.0000.01019.22
8.2.90.0070.00718.91
8.2.80.0040.00818.89
8.2.70.0220.00918.93
8.2.60.0260.00019.00
8.2.50.0120.00418.87
8.2.40.0140.00019.07
8.2.30.0200.00318.78
8.2.20.0100.00319.01
8.2.10.0140.00018.91
8.2.00.0110.00319.08
8.1.330.0140.00422.28
8.1.320.0120.00716.45
8.1.310.0110.00720.23
8.1.300.0120.00419.63
8.1.290.0060.00330.84
8.1.280.0150.00025.92
8.1.270.0090.00023.99
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0120.00318.80
8.1.230.0100.00718.60
8.1.220.0120.00418.82
8.1.210.0260.00320.07
8.1.200.0140.00018.73
8.1.190.0150.00018.56
8.1.180.0330.00018.30
8.1.170.0110.00418.78
8.1.160.0140.00418.55
8.1.150.0040.00820.69
8.1.140.0270.00318.60
8.1.130.0040.01118.69
8.1.120.0140.00018.68
8.1.110.0080.00518.62
8.1.100.0190.00318.52
8.1.90.0110.00418.69
8.1.80.0170.01318.58
8.1.70.0060.00618.88
8.1.60.0160.00018.81
8.1.50.0120.00318.66
8.1.40.0200.00318.67
8.1.30.0190.00818.98
8.1.20.0130.00318.86
8.1.10.0120.00018.86
8.1.00.0130.00318.60
8.0.300.0140.01417.93
8.0.290.0120.00417.89
8.0.280.0150.00817.95
8.0.270.0110.00317.90
8.0.260.0090.00617.54
8.0.250.0100.00317.99
8.0.240.0100.00517.89
8.0.230.0050.00918.23
8.0.220.0120.00417.93
8.0.210.0070.00717.94
8.0.200.0150.00017.96
8.0.190.0100.00517.96
8.0.180.0140.00018.12
8.0.170.0080.00418.14
8.0.160.0090.00617.96
8.0.150.0120.00417.86
8.0.140.0150.00018.00
8.0.130.0060.00618.16
8.0.120.0070.00717.95
8.0.110.0130.00018.08
8.0.100.0090.00617.75
8.0.90.0150.00018.01
8.0.80.0120.00317.85
8.0.70.0110.00318.02
8.0.60.0140.00018.00
8.0.50.0070.00718.05
8.0.30.0140.00018.04
8.0.20.0120.00317.95
8.0.10.0100.00517.99

preferences:
39.61 ms | 403 KiB | 5 Q