3v4l.org

run code in 300+ PHP versions simultaneously
<?php $originalString = "Hello world, what do you think of today's weather"; $findString = ' '; $nthOccurrence = 8; $newWord = 'beautiful '; function insertAfterNth($input, $find, $newString, $nth = 1) { $parts = explode($find, $input, $nth + 1); $parts[$nth] = $newString . $parts[$nth]; return implode($find, $parts); } echo insertAfterNth($originalString, $findString, $newWord, $nthOccurrence);

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.4.140.0110.01017.70
8.4.130.0130.00717.66
8.4.120.0080.00220.35
8.4.110.0080.01222.49
8.4.100.0100.01017.75
8.4.90.0150.00518.75
8.4.80.0100.00317.71
8.4.70.0120.01017.64
8.4.60.0120.00718.63
8.4.50.0110.00419.77
8.4.40.0100.01019.34
8.4.30.0160.00320.49
8.4.20.0130.00717.70
8.4.10.0100.00722.16
8.3.270.0110.00816.35
8.3.260.0110.00916.49
8.3.250.0100.00918.93
8.3.240.0120.00816.63
8.3.230.0110.00916.40
8.3.220.0090.00216.96
8.3.210.0130.00716.78
8.3.200.0050.00416.72
8.3.190.0110.00518.81
8.3.180.0060.00316.50
8.3.170.0150.00418.98
8.3.160.0040.00417.34
8.3.150.0070.01316.48
8.3.140.0040.00416.95
8.3.130.0030.00518.09
8.3.120.0000.00918.99
8.3.110.0100.00020.94
8.3.100.0040.00424.06
8.3.90.0040.00426.77
8.3.80.0060.00317.97
8.3.70.0060.00918.18
8.3.60.0140.00718.43
8.3.50.0070.00718.05
8.3.40.0100.00320.39
8.3.30.0070.01018.67
8.3.20.0170.00024.18
8.3.10.0000.00724.66
8.3.00.0040.00426.16
8.2.290.0150.00420.48
8.2.280.0120.00718.52
8.2.270.0070.01416.84
8.2.260.0070.00316.82
8.2.250.0090.00918.37
8.2.240.0000.00818.95
8.2.230.0000.00922.58
8.2.220.0000.00937.54
8.2.210.0040.00426.77
8.2.200.0090.00016.63
8.2.190.0030.01016.60
8.2.180.0120.00616.63
8.2.170.0090.00618.90
8.2.160.0070.01022.96
8.2.150.0080.00025.66
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0040.00421.13
8.2.110.0060.00322.30
8.2.100.0040.00817.52
8.2.90.0040.00417.92
8.2.80.0030.00618.05
8.2.70.0030.00617.93
8.2.60.0100.00317.91
8.2.50.0000.00818.10
8.2.40.0040.00420.47
8.2.30.0050.00219.60
8.2.20.0060.00318.87
8.2.10.0050.00518.94
8.2.00.0130.00318.99
8.1.330.0050.00420.44
8.1.320.0130.00616.19
8.1.310.0000.00917.93
8.1.300.0030.00618.30
8.1.290.0000.00930.84
8.1.280.0070.01025.92
8.1.270.0040.00424.66
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0000.00922.04
8.1.230.0090.00620.97
8.1.220.0000.00820.68
8.1.210.0060.00318.77
8.1.200.0090.00017.35
8.1.190.0040.00417.23
8.1.180.0050.00318.10
8.1.170.0080.00018.54
8.1.160.0000.01518.59
8.1.150.0100.00518.49
8.1.140.0100.00618.54
8.1.130.0160.00018.54
8.1.120.0160.00018.63
8.1.110.0080.00818.60
8.1.100.0120.00418.58
8.1.90.0120.00318.56
8.1.80.0100.00518.64
8.1.70.0090.00618.70
8.1.60.0130.00418.88
8.1.50.0090.00918.72
8.1.40.0190.00018.90
8.1.30.0110.00718.84
8.1.20.0100.01018.89
8.1.10.0180.00118.78
8.1.00.0200.00018.64
8.0.300.0040.00421.52
8.0.290.0040.00416.75
8.0.280.0130.00418.00
8.0.270.0160.00017.99
8.0.260.0090.00617.97
8.0.250.0060.00318.00
8.0.240.0030.00817.99
8.0.230.0110.00017.90
8.0.220.0120.00217.92
8.0.210.0070.00517.99
8.0.200.0100.00417.91
8.0.190.0130.00018.07
8.0.180.0120.00218.01
8.0.170.0060.00418.01
8.0.160.0130.00218.05
8.0.150.0050.00818.07
8.0.140.0140.00018.02
8.0.130.0090.00318.00
8.0.120.0070.00317.91
8.0.110.0100.00517.99
8.0.100.0070.00717.84
8.0.90.0090.00517.88
8.0.80.0120.00317.91
8.0.70.0100.00517.94
8.0.60.0120.00318.05
8.0.50.0170.00017.96
8.0.30.0080.00617.92
8.0.20.0100.00718.06
8.0.10.0100.00518.09

preferences:
32.34 ms | 403 KiB | 5 Q