3v4l.org

run code in 300+ PHP versions simultaneously
<?php $re = '/\$\w+\K(?|\h*(\[)\h*(\'[^\']+\')\h*|(\h*\[)\h*("[^"]+")\h*)(?=])/m'; $str = '$foo [ "bar" ], $foo ["bar" ], $foo [ "bar"] $foo [ \'bar\' ], $foo [\'bar\' ], $foo [ \'bar\'] $foo [ \'this is different\' ]'; $result = preg_replace($re, '$1$2', $str); echo $result;

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.0100.00819.75
8.5.20.0110.00619.52
8.5.10.0100.01016.61
8.5.00.0100.01220.30
8.4.180.0120.00925.65
8.4.170.0110.01019.75
8.4.160.0090.01221.91
8.4.150.0080.00516.82
8.4.140.0110.00917.66
8.4.130.0140.00718.91
8.4.120.0100.01024.30
8.4.110.0110.00722.47
8.4.100.0120.00917.94
8.4.90.0110.00920.94
8.4.80.0050.00520.64
8.4.70.0060.00219.05
8.4.60.0130.00720.63
8.4.50.0050.00718.82
8.4.40.0060.00919.55
8.4.30.0120.00418.66
8.4.20.0090.01218.87
8.4.10.0110.00820.65
8.3.300.0130.00720.51
8.3.290.0140.00820.79
8.3.280.0090.01218.69
8.3.270.0120.00816.43
8.3.260.0100.00816.56
8.3.250.0110.00818.72
8.3.240.0110.00717.08
8.3.230.0120.00816.57
8.3.220.0060.00118.62
8.3.210.0050.00416.60
8.3.200.0150.00716.43
8.3.190.0060.00417.01
8.3.180.0050.00418.85
8.3.170.0090.00916.86
8.3.160.0090.00918.22
8.3.150.0080.00016.47
8.3.140.0050.00320.56
8.3.130.0060.00318.41
8.3.120.0110.00420.57
8.3.110.0060.00320.94
8.3.100.0080.00016.78
8.3.90.0040.00426.77
8.3.80.0060.00316.75
8.3.70.0060.01216.58
8.3.60.0100.01018.31
8.3.50.0140.00316.58
8.3.40.0060.01218.93
8.3.30.0060.00818.85
8.3.20.0040.00424.18
8.3.10.0000.00824.66
8.3.00.0040.00426.16
8.2.300.0140.00522.18
8.2.290.0130.00716.84
8.2.280.0100.01018.39
8.2.270.0100.00716.93
8.2.260.0000.00817.09
8.2.250.0000.00716.93
8.2.240.0030.00717.04
8.2.230.0100.01022.58
8.2.220.0080.00024.06
8.2.210.0020.00526.77
8.2.200.0040.00416.63
8.2.190.0140.00416.63
8.2.180.0040.01225.92
8.2.170.0150.00322.96
8.2.160.0040.01122.96
8.2.150.0030.00625.66
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0000.00726.35
8.2.110.0030.00622.41
8.2.100.0080.00419.76
8.2.90.0050.00318.05
8.2.80.0030.00619.09
8.2.70.0050.00317.75
8.2.60.0000.01017.80
8.2.50.0080.00318.07
8.2.40.0000.00818.35
8.2.30.0040.00418.14
8.2.20.0030.00518.20
8.2.10.0040.00421.02
8.2.00.0080.00319.21
8.1.340.0120.00923.63
8.1.330.0090.00622.24
8.1.320.0140.00916.29
8.1.310.0090.00618.44
8.1.300.0130.00318.04
8.1.290.0030.00730.84
8.1.280.0070.01125.92
8.1.270.0040.00423.99
8.1.260.0050.00328.09
8.1.250.0060.00328.09
8.1.240.0000.00923.82
8.1.230.0070.00417.70
8.1.220.0050.00317.80
8.1.210.0050.00318.77
8.1.200.0060.00317.35
8.1.190.0030.00517.35
8.1.180.0090.00018.10
8.1.170.0040.00418.62
8.1.160.0040.00418.92
8.1.150.0070.00018.84
8.1.140.0000.00718.86
8.1.130.0050.00220.11
8.1.120.0030.00517.57
8.1.110.0050.00317.55
8.1.100.0040.00417.57
8.1.90.0060.00317.55
8.1.80.0040.00417.55
8.1.70.0070.00017.46
8.1.60.0040.00417.56
8.1.50.0000.00817.64
8.1.40.0040.00417.66
8.1.30.0070.00417.77
8.1.20.0040.00417.77
8.1.10.0050.00317.71
8.1.00.0030.00617.46
8.0.300.0040.00418.77
8.0.290.0080.00016.88
8.0.280.0050.00218.51
8.0.270.0040.00418.21
8.0.260.0030.00318.52
8.0.250.0050.00317.13
8.0.240.0040.00416.98
8.0.230.0070.00016.98
8.0.220.0070.00016.95
8.0.210.0030.00316.89
8.0.200.0000.00717.05
8.0.190.0030.00516.94
8.0.180.0050.00316.91
8.0.170.0030.00617.01
8.0.160.0040.00416.87
8.0.150.0000.00716.90
8.0.140.0030.00716.86
8.0.130.0030.00313.41
8.0.120.0060.00316.95
8.0.110.0040.00416.78
8.0.100.0000.00716.91
8.0.90.0000.00717.05
8.0.80.0040.01416.90
8.0.70.0000.00716.85
8.0.60.0030.00616.98
8.0.50.0050.00216.82
8.0.30.0090.01316.90
8.0.20.0070.01416.98
8.0.10.0110.01117.07
8.0.00.0000.01717.14
7.4.330.0000.00515.55
7.4.320.0070.00016.80
7.4.300.0030.00316.71
7.4.290.0000.00716.60
7.4.280.0050.00216.73
7.4.270.0000.00816.61
7.4.260.0030.00313.42
7.4.250.0050.00316.53
7.4.240.0000.00816.69
7.4.230.0000.00716.69
7.4.220.0000.00716.80
7.4.210.0080.00916.71
7.4.200.0000.00716.83
7.4.160.0100.01016.77
7.4.150.0090.01216.86
7.4.140.0080.00816.57
7.4.130.0120.00416.71
7.4.120.0040.01116.66
7.4.110.0080.01316.75
7.4.100.0090.01216.63
7.4.90.0030.01116.76
7.4.80.0140.00016.71
7.4.70.0070.00816.77
7.4.60.0060.00916.54
7.4.50.0070.01116.66
7.4.40.0110.00716.79
7.4.30.0060.00916.63
7.4.20.0160.00316.64
7.4.10.0030.01716.72
7.4.00.0060.01116.52
7.3.330.0040.00416.43
7.3.320.0030.00313.14
7.3.310.0000.00716.34
7.3.300.0030.00316.28
7.3.290.0100.00616.42
7.3.270.0060.00916.39
7.3.260.0030.01316.40
7.3.250.0090.00616.39
7.3.240.0120.00616.34
7.3.230.0040.01216.36
7.3.220.0060.00916.35
7.3.210.0060.00916.25
7.3.200.0070.00716.29
7.3.190.0120.00316.32
7.3.180.0090.00616.28
7.3.170.0060.00816.31
7.3.160.0070.01016.25
7.3.150.0110.00916.29
7.3.140.0070.00716.32
7.3.130.0060.01416.32
7.3.120.0120.00816.26
7.3.110.0120.00616.23
7.3.100.0110.01116.19
7.3.90.0110.00416.57
7.3.80.0140.00716.31
7.3.70.0000.01516.33
7.3.60.0170.00316.43
7.3.50.0000.01516.53
7.3.40.0060.00916.43
7.3.30.0120.00616.45
7.3.20.0060.00916.43
7.3.10.0090.00616.43
7.3.00.0090.00616.46

preferences:
54.85 ms | 1391 KiB | 5 Q