3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "I have some fruits like [name], [another_name] and [one_another_name]"; $fruits_array = array("Banana", "Apple", "Orange"); $string = preg_replace_callback( '/\[[^]]+\]/', function ($matches) use (&$fruits_array) { return array_shift($fruits_array); }, $string ); 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.3.60.0090.00618.29
8.3.50.0070.00718.19
8.3.40.0120.00318.72
8.3.30.0160.00318.84
8.3.20.0050.00319.20
8.3.10.0060.00319.15
8.3.00.0000.00823.52
8.2.180.0130.00616.38
8.2.170.0040.01122.96
8.2.160.0070.00721.06
8.2.150.0080.00024.18
8.2.140.0030.00624.66
8.2.130.0040.00426.16
8.2.120.0060.00319.54
8.2.110.0030.00622.38
8.2.100.0100.00018.03
8.2.90.0090.00018.22
8.2.80.0040.00417.97
8.2.70.0050.00318.04
8.2.60.0050.00318.03
8.2.50.0040.00818.10
8.2.40.0050.00319.38
8.2.30.0040.00419.34
8.2.20.0040.00417.94
8.2.10.0040.00418.29
8.2.00.0040.00419.40
8.1.280.0100.00725.92
8.1.270.0070.00722.05
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0090.00022.01
8.1.230.0110.00022.66
8.1.220.0040.00417.74
8.1.210.0030.00518.77
8.1.200.0030.00617.48
8.1.190.0030.00517.35
8.1.180.0000.00818.10
8.1.170.0060.00318.81
8.1.160.0070.00018.90
8.1.150.0000.00718.92
8.1.140.0040.00417.68
8.1.130.0000.00718.91
8.1.120.0000.00717.61
8.1.110.0000.00717.67
8.1.100.0040.00417.68
8.1.90.0000.00817.50
8.1.80.0000.00717.52
8.1.70.0040.00417.51
8.1.60.0000.00817.77
8.1.50.0070.00717.57
8.1.40.0030.00617.66
8.1.30.0000.00817.74
8.1.20.0040.00417.82
8.1.10.0000.00717.66
8.1.00.0040.00417.63
8.0.300.0070.00019.66
8.0.290.0040.00416.88
8.0.280.0000.00718.35
8.0.270.0070.00017.20
8.0.260.0000.00717.20
8.0.250.0000.00717.10
8.0.240.0000.00817.08
8.0.230.0040.00417.10
8.0.220.0000.00717.07
8.0.210.0000.00716.93
8.0.200.0080.00017.09
8.0.190.0040.00417.10
8.0.180.0000.00717.10
8.0.170.0060.00316.95
8.0.160.0000.01117.11
8.0.150.0000.00716.99
8.0.140.0000.00817.02
8.0.130.0000.00613.46
8.0.120.0050.00216.90
8.0.110.0040.00417.09
8.0.100.0090.00016.93
8.0.90.0030.00317.00
8.0.80.0050.01417.00
8.0.70.0040.00417.06
8.0.60.0040.00416.92
8.0.50.0040.00416.94
8.0.30.0100.01017.18
8.0.20.0050.01317.40
8.0.10.0000.00817.08
8.0.00.0070.01016.99
7.4.330.0060.00015.55
7.4.320.0000.00816.84
7.4.300.0000.00716.86
7.4.290.0040.00416.82
7.4.280.0000.00816.66
7.4.270.0060.00316.80
7.4.260.0030.00416.71
7.4.250.0000.00716.67
7.4.240.0000.00716.86
7.4.230.0070.00016.64
7.4.220.0000.00716.76
7.4.210.0090.00816.79
7.4.200.0030.00416.60
7.4.160.0090.00616.66
7.4.140.0080.01017.86
7.4.130.0090.01516.89
7.4.120.0090.01016.64
7.4.110.0070.01116.78
7.4.100.0110.00616.51
7.4.90.0030.01316.75
7.4.80.0180.00019.39
7.4.70.0090.01216.78
7.4.60.0100.00716.51
7.4.50.0070.01016.84
7.4.40.0210.00316.62
7.4.00.0110.00715.05
7.3.330.0000.00513.27
7.3.320.0040.00413.42
7.3.310.0030.00416.50
7.3.300.0030.00316.32
7.3.290.0000.00716.40
7.3.280.0080.00816.49
7.3.260.0120.00716.56
7.3.240.0120.00716.67
7.3.230.0100.01416.45
7.3.210.0100.00716.85
7.3.200.0090.01316.68
7.3.190.0120.00416.56
7.3.180.0080.00816.44
7.3.170.0110.00716.85
7.3.160.0050.01116.72
7.2.330.0090.00916.80
7.2.320.0110.00816.69
7.2.310.0120.01216.88
7.2.300.0110.00616.71
7.2.290.0120.00616.68
7.2.60.1480.00915.05
7.2.50.1780.00814.94
7.2.40.1420.01515.54
7.2.30.1680.00715.69
7.2.20.2050.00915.67
7.2.10.2030.01115.82
7.2.00.1620.01015.72
7.1.200.0060.00915.86
7.1.170.1310.00813.66
7.1.160.1500.01316.92
7.1.150.1570.00917.11
7.1.140.1600.01216.76
7.1.130.1870.01017.18
7.1.120.1330.01016.68
7.1.110.1300.00716.27
7.1.100.1370.00816.10
7.1.90.1760.01016.42
7.1.80.0150.01316.63
7.1.70.1800.00615.42
7.1.60.2680.02033.37
7.1.50.1700.01233.27
7.1.40.2340.01432.88
7.1.30.2420.01932.93
7.1.20.0370.01233.06
7.1.10.2090.01215.18
7.1.00.0120.01115.08

preferences:
55.69 ms | 400 KiB | 5 Q