3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pattern = "~([^\d.,]|[.,](?!\d{2}$))|(,)~m"; $strings = [ "2.578,20", "2 354,20", "234", "234,256.20", "234,205", "246 548", "244'056", "26'155.25", "12,20", "13.33", ]; foreach ($strings as $string) { echo preg_replace_callback($pattern, function ($matches) { if (isset($matches[2])) return "."; if (isset($matches[1])) return ""; }, $string) . PHP_EOL; }

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.0170.00522.16
8.4.150.0090.00616.97
8.4.140.0140.00717.60
8.4.130.0130.00718.07
8.4.120.0110.00823.83
8.4.110.0120.00922.46
8.4.100.0140.00618.88
8.4.90.0120.00918.66
8.4.80.0050.00319.04
8.4.70.0090.00918.21
8.4.60.0070.01418.98
8.4.50.0120.00820.60
8.4.40.0070.01318.05
8.4.30.0030.00618.91
8.4.20.0060.01318.05
8.4.10.0050.00517.85
8.3.280.0010.00114.05
8.3.270.0130.00716.80
8.3.260.0090.01016.80
8.3.250.0130.00616.82
8.3.240.0040.00417.30
8.3.230.0100.00716.78
8.3.220.0100.00817.34
8.3.210.0130.00618.56
8.3.200.0050.00416.73
8.3.190.0080.00717.38
8.3.180.0060.01316.80
8.3.170.0060.00317.25
8.3.160.0120.00618.47
8.3.150.0040.00419.05
8.3.140.0070.00317.11
8.3.130.0040.00418.69
8.3.120.0100.00020.86
8.3.110.0100.00020.94
8.3.100.0050.00316.69
8.3.90.0160.00316.64
8.3.80.0100.00016.88
8.3.70.0130.00916.75
8.3.60.0060.01216.62
8.3.50.0060.00723.73
8.3.40.0100.00719.14
8.3.30.0110.00718.96
8.3.20.0030.00622.64
8.3.10.0050.00220.32
8.3.00.0040.00420.73
8.2.290.0090.00920.28
8.2.280.0130.00718.78
8.2.270.0070.01117.01
8.2.260.0100.01018.63
8.2.250.0040.00418.85
8.2.240.0030.00619.37
8.2.230.0080.00022.58
8.2.220.0090.00024.06
8.2.210.0000.00826.77
8.2.200.0040.00818.38
8.2.190.0100.01317.13
8.2.180.0190.00018.54
8.2.170.0070.00722.96
8.2.160.0070.00721.98
8.2.150.0040.00424.18
8.2.140.0070.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00426.16
8.2.110.0070.00421.07
8.2.100.0080.00418.09
8.2.90.0050.00319.34
8.2.80.0050.00518.04
8.2.70.0080.00017.75
8.2.60.0000.00818.04
8.2.50.0080.00018.07
8.2.40.0030.00618.47
8.2.30.0000.00718.22
8.2.20.0090.00018.09
8.2.10.0070.00019.28
8.2.00.0000.00719.44
8.1.330.0100.00622.13
8.1.320.0070.00916.53
8.1.310.0100.00318.65
8.1.300.0030.00619.93
8.1.290.0030.00718.88
8.1.280.0070.01125.92
8.1.270.0040.00423.71
8.1.260.0070.00326.35
8.1.250.0070.00028.09
8.1.240.0060.00322.61
8.1.230.0060.00617.89
8.1.220.0050.00317.76
8.1.210.0090.00018.77
8.1.200.0060.00317.48
8.1.190.0000.00817.48
8.1.180.0000.00718.89
8.1.170.0030.00520.24
8.1.160.0050.00219.09
8.1.150.0040.00419.03
8.1.140.0040.00418.99
8.1.130.0040.00417.58
8.1.120.0050.00217.63
8.1.110.0000.00817.51
8.1.100.0000.00817.59
8.1.90.0000.00817.52
8.1.80.0050.00217.50
8.1.70.0030.00617.52
8.1.60.0040.00417.77
8.1.50.0040.00417.60
8.1.40.0090.00017.62
8.1.30.0030.00617.82
8.1.20.0100.00317.82
8.1.10.0040.00417.79
8.1.00.0060.00617.55
8.0.300.0070.00018.77
8.0.290.0070.00016.75
8.0.280.0040.00418.50
8.0.270.0000.00818.17
8.0.260.0050.00320.23
8.0.250.0030.00417.08
8.0.240.0030.00317.08
8.0.230.0000.00617.02
8.0.220.0000.00716.97
8.0.210.0070.00016.95
8.0.200.0060.00017.17
8.0.190.0000.00716.99
8.0.180.0000.00817.05
8.0.170.0060.00317.07
8.0.160.0050.00217.01
8.0.150.0000.00817.01
8.0.140.0050.00216.97
8.0.130.0060.00013.40
8.0.120.0000.00816.98
8.0.110.0070.00016.98
8.0.100.0000.00716.98
8.0.90.0000.00717.14
8.0.80.0070.00717.08
8.0.70.0030.00616.95
8.0.60.0070.00017.01
8.0.50.0040.00416.90
8.0.30.0120.01217.38
8.0.20.0150.00817.39
8.0.10.0000.00917.10
8.0.00.0100.01016.97
7.4.330.0060.00015.55
7.4.320.0030.00316.80
7.4.300.0070.00016.89
7.4.290.0040.00416.81
7.4.280.0030.00616.80
7.4.270.0000.00816.88
7.4.260.0050.00013.56
7.4.250.0030.00316.73
7.4.240.0040.00316.83
7.4.230.0000.00716.94
7.4.220.0050.00216.79
7.4.210.0040.01116.95
7.4.200.0030.00316.80
7.4.130.0080.00916.59
7.4.120.0120.00616.80
7.4.110.0030.01316.68
7.4.100.0130.00416.85
7.4.90.0120.01116.68
7.4.80.0090.02119.39
7.4.70.0100.00716.77
7.4.60.0120.00416.64
7.4.50.0090.00616.55
7.4.40.0130.00616.62
7.4.30.0110.01116.58
7.4.20.0140.00016.58
7.4.10.0000.01716.70
7.4.00.0140.00316.72
7.3.330.0000.01016.50
7.3.320.0050.00013.42
7.3.310.0030.00316.45
7.3.300.0000.00716.36
7.3.290.0150.00916.44
7.3.280.0140.00016.39
7.3.260.0090.01316.48
7.3.230.0080.01016.46
7.3.210.0120.00616.50
7.3.200.0070.01016.83
7.3.190.0100.00716.54
7.3.180.0030.01316.66
7.3.170.0130.00316.50
7.3.160.0040.01316.88
7.3.150.0160.00616.46
7.3.140.0030.01216.69
7.3.130.0130.00316.51
7.3.120.0040.01116.30
7.3.110.0150.00716.71
7.3.100.0030.01216.65
7.3.90.0100.01016.44
7.3.80.0090.00916.85
7.3.70.0030.01216.40
7.3.60.0070.01016.60
7.3.50.0080.00816.62
7.3.40.0140.00316.70
7.3.30.0070.01016.62
7.3.20.0040.01516.47
7.3.10.0060.01716.63
7.3.00.0130.00216.56
7.2.330.0110.00716.93
7.2.320.0120.00916.64
7.2.310.0090.00916.73
7.2.300.0140.00416.85
7.2.290.0130.00316.82
7.2.280.0060.00916.84
7.2.270.0080.00816.68
7.2.260.0070.01016.77
7.2.250.0090.01016.83
7.2.240.0100.00716.90
7.2.230.0100.01116.87
7.2.220.0130.00316.78
7.2.210.0040.01216.69
7.2.200.0160.00016.75
7.2.190.0090.00616.71
7.2.180.0050.01116.73
7.2.170.0080.00816.74
7.2.160.0090.00916.79
7.2.150.0060.01616.82
7.2.140.0080.01116.82
7.2.130.0060.01116.86
7.2.120.0080.00816.80
7.2.110.0120.00316.86
7.2.100.0130.00316.94
7.2.90.0070.01116.95
7.2.80.0030.01416.64
7.2.70.0120.00416.70
7.2.60.0100.00716.87
7.2.50.0070.01116.54
7.2.40.0100.00716.96
7.2.30.0120.00616.73
7.2.20.0080.00816.77
7.2.10.0060.00916.61
7.2.00.0100.00616.85

preferences:
31.4 ms | 403 KiB | 5 Q