3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Everything you enter here will be executed by our servers. Try it! $uri = "?sort%5B%5D=1&str%5B%5D=4&curs%5B%5D=1&page=2&page=1&page=2&page=5&page=4&page=3&page=2&page=1&page=1&page=1&page=1&page=1&page=1&page=1&page=1&page=1&page=1&page=1&tesdsd=2"; function sgp($url, $varname, $value) // substitute get parameter { if (is_array($varname)) { foreach ($varname as $i => $n) { $v = (is_array($value)) ? ( isset($value[$i]) ? $value[$i] : NULL ) : $value; $url = sgp($url, $n, $v); } return $url; } preg_match('/^([^?]+)(\?.*?)?(#.*)?$/', $url, $matches); $gp = (isset($matches[2])) ? $matches[2] : ''; // GET-parameters if (!$gp) return $url; $pattern = "/([?&])$varname=.*?(?=&|#|\z)/"; if (preg_match($pattern, $gp)) { $substitution = ($value !== '') ? "\${1}$varname=" . preg_quote($value) : ''; $newgp = preg_replace($pattern, $substitution, $gp); // new GET-parameters $newgp = preg_replace('/^&/', '?', $newgp); } else { $s = ($gp) ? '&' : '?'; $newgp = $gp.$s.$varname.'='.$value; } $anchor = (isset($matches[3])) ? $matches[3] : ''; $newurl = $matches[1].$newgp.$anchor; return $newurl; } var_dump(sgp($uri,array('page'),array(1)));

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.20.0090.00918.09
8.4.10.0100.01019.48
8.3.150.0130.00620.61
8.3.140.0040.00418.95
8.3.130.0050.00318.29
8.3.120.0030.00720.81
8.3.110.0080.00020.94
8.3.100.0030.01324.06
8.3.90.0170.00726.77
8.3.80.0030.00617.00
8.3.70.0140.00718.53
8.3.60.0040.01116.63
8.3.50.0130.00916.61
8.3.40.0090.00619.00
8.3.30.0120.00318.97
8.3.20.0080.00019.03
8.3.10.0090.00020.61
8.3.00.0060.00319.63
8.2.270.0110.00716.91
8.2.260.0060.00316.75
8.2.250.0090.00016.96
8.2.240.0100.00017.05
8.2.230.0050.00322.58
8.2.220.0000.00837.54
8.2.210.0060.00626.77
8.2.200.0090.00016.63
8.2.190.0070.01116.58
8.2.180.0110.00718.66
8.2.170.0040.01122.96
8.2.160.0070.01421.36
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0000.00819.61
8.2.110.0000.01022.29
8.2.100.0060.00618.03
8.2.90.0040.00417.97
8.2.80.0080.00017.97
8.2.70.0060.00317.88
8.2.60.0060.00317.80
8.2.50.0000.00818.07
8.2.40.0050.00318.16
8.2.30.0000.00818.27
8.2.20.0110.00018.07
8.2.10.0040.00417.97
8.2.00.0000.00918.00
8.1.310.0040.01118.66
8.1.300.0040.00418.30
8.1.290.0000.00930.84
8.1.280.0160.00325.92
8.1.270.0050.00523.98
8.1.260.0060.00326.35
8.1.250.0000.00728.09
8.1.240.0030.00622.59
8.1.230.0090.00320.93
8.1.220.0080.00017.76
8.1.210.0080.00018.85
8.1.200.0030.00617.50
8.1.190.0040.00417.35
8.1.180.0050.00318.10
8.1.170.0080.00018.87
8.1.160.0000.00718.88
8.1.150.0050.00318.71
8.1.140.0000.00817.73
8.1.130.0030.00317.92
8.1.120.0000.00817.53
8.1.110.0040.00417.55
8.1.100.0040.00417.51
8.1.90.0040.00417.62
8.1.80.0000.00717.61
8.1.70.0040.00417.63
8.1.60.0050.00317.80
8.1.50.0040.00417.53
8.1.40.0040.00417.70
8.1.30.0000.00817.84
8.1.20.0000.00817.72
8.1.10.0050.00317.71
8.1.00.0000.00817.61
8.0.300.0040.00419.86
8.0.290.0020.00517.00
8.0.280.0040.00418.41
8.0.270.0030.00618.08
8.0.260.0030.00316.93
8.0.250.0050.00317.01
8.0.240.0030.00617.17
8.0.230.0000.00717.14
8.0.220.0020.00517.06
8.0.210.0070.00017.08
8.0.200.0000.00717.12
8.0.190.0040.00417.15
8.0.180.0000.00817.10
8.0.170.0030.00517.08
8.0.160.0000.00817.04
8.0.150.0040.00417.05
8.0.140.0050.00317.05
8.0.130.0060.00013.48
8.0.120.0050.00316.99
8.0.110.0080.00017.02
8.0.100.0040.00416.84
8.0.90.0040.00416.92
8.0.80.0040.01117.06
8.0.70.0000.00717.03
8.0.60.0040.00417.11
8.0.50.0100.00016.95
8.0.30.0140.00517.30
8.0.20.0110.00817.14
8.0.10.0000.00717.04
8.0.00.0130.01017.05
7.4.330.0030.00313.25
7.4.320.0030.00316.75
7.4.300.0060.00316.66
7.4.290.0000.00716.88
7.4.280.0030.00616.76
7.4.270.0000.00716.84
7.4.260.0060.00013.46
7.4.250.0040.00416.74
7.4.240.0000.00816.85
7.4.230.0000.00816.85
7.4.220.0120.00616.70
7.4.210.0040.01016.78
7.4.200.0020.00516.84
7.4.190.0040.00416.79
7.4.160.0030.01516.76
7.4.150.0150.00316.67
7.4.140.0120.00716.61
7.4.130.0050.01216.83
7.4.120.0050.01216.72
7.4.110.0110.00616.54
7.4.100.0130.00316.82
7.4.90.0120.00616.70
7.4.80.0130.00719.39
7.4.70.0030.01416.91
7.4.60.0090.00916.72
7.4.50.0000.00916.73
7.4.40.0040.00416.70
7.4.30.0040.01416.93
7.4.10.0020.01414.93
7.4.00.0110.00815.16
7.3.330.0000.00613.52
7.3.320.0000.00613.39
7.3.310.0040.00416.52
7.3.300.0050.00216.57
7.3.290.0030.01316.46
7.3.280.0110.00616.53
7.3.270.0130.00616.74
7.3.260.0060.01216.64
7.3.250.0130.00616.51
7.3.240.0080.00816.71
7.3.230.0230.00016.87
7.3.210.0120.00916.74
7.3.200.0030.01316.89
7.3.190.0100.00716.65
7.3.180.0100.00616.46
7.3.170.0100.00716.47
7.3.160.0000.02016.56
7.3.130.0100.00815.05
7.3.120.0090.00815.05
7.3.110.0130.00615.28
7.3.100.0070.00915.10
7.3.90.0090.00615.10
7.3.80.0070.00715.14
7.3.70.0070.00615.08
7.3.60.0070.00915.10
7.3.50.0070.01014.79
7.3.40.0070.00514.89
7.3.30.0080.00715.03
7.3.20.0040.01216.82
7.3.10.0080.00516.69
7.3.00.0010.01216.79
7.2.330.0090.00916.88
7.2.320.0090.01316.98
7.2.310.0100.01416.81
7.2.300.0110.00516.89
7.2.290.0000.01916.93
7.2.260.0100.00915.36
7.2.250.0030.01315.26
7.2.240.0070.00915.06
7.2.230.0110.00515.48
7.2.220.0030.00915.29
7.2.210.0080.00615.23
7.2.200.0080.00815.36
7.2.190.0040.01315.34
7.2.180.0070.01015.16
7.2.170.0060.00715.21
7.2.160.0030.01215.31
7.2.150.0050.00817.17
7.2.140.0100.00717.18
7.2.130.0030.00817.09
7.2.120.0030.01316.97
7.2.110.0030.01317.04
7.2.100.0100.00517.14
7.2.90.0090.00517.00
7.2.80.0090.00817.11
7.2.70.0030.00717.00
7.2.60.0050.00717.14
7.2.50.0090.00617.23
7.2.40.0050.00917.15
7.2.30.0020.00717.24
7.2.20.0030.00717.21
7.2.10.0080.00717.00
7.2.00.0070.00717.98
7.1.330.0030.01116.06
7.1.320.0050.01116.12
7.1.310.0000.01415.93
7.1.300.0110.00515.93
7.1.290.0030.00915.71
7.1.280.0050.00716.11
7.1.270.0040.00715.98
7.1.260.0060.00815.96
7.1.250.0020.01116.01
7.1.240.0050.00815.98
7.1.230.0050.00815.91
7.1.220.0100.00616.02
7.1.210.0070.00715.85
7.1.200.0080.00716.01
7.1.190.0050.00715.93
7.1.180.0090.00215.99
7.1.170.0070.00615.94
7.1.160.0020.00716.01
7.1.150.0060.00416.09
7.1.140.0060.00916.00
7.1.130.0020.01115.96
7.1.120.0050.00815.93
7.1.110.0070.00715.98
7.1.100.0220.00816.09
7.1.90.0030.01015.89
7.1.80.0070.00715.86
7.1.70.0030.00916.47
7.1.60.0060.01317.19
7.1.50.0030.01216.44
7.1.40.0070.00316.05
7.1.30.0080.00316.03
7.1.20.0050.00515.99
7.1.10.0120.00216.02
7.1.00.0030.03018.22
7.0.330.0030.00915.66
7.0.320.0070.00815.67
7.0.310.0050.00815.42
7.0.300.0010.01015.52
7.0.290.0070.00715.69
7.0.280.0030.00815.57
7.0.270.0070.00515.65
7.0.260.0040.00715.47
7.0.250.0000.01215.51
7.0.240.0010.01115.42
7.0.230.0040.00915.70
7.0.220.0030.00915.79
7.0.210.0030.00815.59
7.0.200.0110.00415.31
7.0.190.0000.01215.72
7.0.180.0030.01015.51
7.0.170.0030.00815.58
7.0.160.0040.01115.67
7.0.150.0120.00315.62
7.0.140.0060.02817.81
7.0.130.0060.00815.75
7.0.120.0060.02817.67
7.0.110.0050.01115.65
7.0.100.0050.01015.58
7.0.90.0070.00515.68
7.0.80.0080.00515.70
7.0.70.0060.00915.77
7.0.60.0050.03317.11
7.0.50.0070.03116.44
7.0.40.0030.02915.88
7.0.30.0140.03415.87
7.0.20.0140.01315.88
7.0.10.0110.02515.77
7.0.00.0060.02115.85
5.6.400.0050.01014.65
5.6.390.0050.00714.46
5.6.380.0060.00314.61
5.6.370.0050.00614.63
5.6.360.0050.00514.54
5.6.350.0080.00614.27
5.6.340.0050.00614.43
5.6.330.0020.00914.48
5.6.320.0000.01014.61
5.6.310.0070.00914.55
5.6.300.0070.00714.38
5.6.290.0030.00714.60
5.6.280.0060.02916.80
5.6.270.0110.00314.76
5.6.260.0050.01214.71
5.6.250.0040.01014.60
5.6.240.0040.00414.48
5.6.230.0080.00814.54
5.6.220.0100.00414.52
5.6.210.0040.03016.55
5.6.200.0060.03315.76
5.6.190.0050.02216.64
5.6.180.0130.03416.50
5.6.170.0100.02616.49
5.6.160.0090.03116.40
5.6.150.0050.02815.66
5.6.140.0070.03015.71
5.6.130.0040.02115.81
5.6.120.0110.02916.82
5.6.110.0050.02516.65
5.6.100.0050.01616.64
5.6.90.0030.03316.75
5.6.80.0010.03216.49
5.6.70.0030.01214.58
5.6.60.0040.00914.44
5.6.50.0070.00714.62
5.6.40.0070.00914.38
5.6.30.0070.00314.48
5.6.20.0100.00314.59
5.6.10.0090.00614.33
5.6.00.0050.01214.45
5.5.380.0050.00514.30
5.5.370.0020.01314.26
5.5.360.0060.00714.29
5.5.350.0150.02716.53
5.5.340.0050.01815.60
5.5.330.0070.02216.24
5.5.320.0090.03316.30
5.5.310.0100.03216.42
5.5.300.0080.03015.65
5.5.290.0040.02215.69
5.5.280.0140.02716.40
5.5.270.0070.01716.71
5.5.260.0050.03216.51
5.5.250.0100.03116.45
5.5.240.0100.02016.43
5.5.230.0060.00614.47
5.5.220.0050.00714.23
5.5.210.0070.00414.37
5.5.200.0010.00814.50
5.5.190.0050.00714.32
5.5.180.0030.00714.48
5.5.170.0040.00914.45
5.5.160.0050.01014.31
5.5.150.0020.01014.43
5.5.140.0030.00914.40
5.5.130.0020.01014.42
5.5.120.0090.00214.22
5.5.110.0070.01014.02
5.5.100.0100.00414.41
5.5.90.0100.00514.58
5.5.80.0050.00814.26
5.5.70.0020.01014.34
5.5.60.0070.00714.24
5.5.50.0070.00714.26
5.5.40.0060.00814.30
5.5.30.0110.00514.27
5.5.20.0050.00714.35
5.5.10.0040.00614.21
5.5.00.0020.00814.29
5.4.450.0060.01914.14
5.4.440.0060.01814.21
5.4.430.0030.02914.10
5.4.420.0060.02014.32
5.4.410.0040.02614.14
5.4.400.0060.02714.06
5.4.390.0040.01714.09
5.4.380.0050.02214.07
5.4.370.0090.02614.10
5.4.360.0020.01814.17
5.4.350.0040.02114.11
5.4.340.0020.02814.06
5.4.330.0000.01011.52
5.4.320.0050.02714.08
5.4.310.0070.01314.22
5.4.300.0060.03114.08
5.4.290.0030.02814.05
5.4.280.0070.02714.08
5.4.270.0090.02514.10
5.4.260.0060.02514.12
5.4.250.0070.02414.08
5.4.240.0040.02813.97
5.4.230.0050.02714.17
5.4.220.0080.02714.20
5.4.210.0060.01614.20
5.4.200.0070.02814.18
5.4.190.0070.02913.99
5.4.180.0060.03114.02
5.4.170.0070.02614.08
5.4.160.0050.01613.99
5.4.150.0030.02214.18
5.4.140.0060.02513.15
5.4.130.0060.01613.30
5.4.120.0020.02713.22
5.4.110.0100.01413.19
5.4.100.0070.02713.25
5.4.90.0060.03013.20
5.4.80.0050.01713.26
5.4.70.0030.02713.18
5.4.60.0040.01713.10
5.4.50.0040.02513.19
5.4.40.0020.02813.17
5.4.30.0040.03013.13
5.4.20.0060.03013.30
5.4.10.0040.02913.00
5.4.00.0100.01913.06
5.3.290.0040.01512.44
5.3.280.0040.02312.37
5.3.270.0040.02812.51
5.3.260.0070.01412.42
5.3.250.0030.01912.50
5.3.240.0020.01812.37
5.3.230.0050.02812.38
5.3.220.0050.03012.33
5.3.210.0050.02812.31
5.3.200.0030.03012.41
5.3.190.0050.03012.44
5.3.180.0040.03112.45
5.3.170.0040.03012.47
5.3.160.0020.01812.46
5.3.150.0020.03112.45
5.3.140.0020.01812.55
5.3.130.0060.01912.44
5.3.120.0020.03112.41
5.3.110.0040.02212.46
5.3.100.0050.01912.34
5.3.90.0050.01812.22
5.3.80.0000.01912.22
5.3.70.0060.02512.19
5.3.60.0070.02312.25
5.3.50.0040.02612.19
5.3.40.0020.02412.23
5.3.30.0030.02112.21
5.3.20.0050.02812.18
5.3.10.0080.02312.08
5.3.00.0010.02312.07
5.2.170.0030.05711.13
5.2.160.0000.04011.13
5.2.150.0100.05711.09
5.2.140.0000.03311.31
5.2.130.0070.03311.27
5.2.120.0000.04711.18
5.2.110.0130.03311.08
5.2.100.0000.03311.16
5.2.90.0070.03011.13
5.2.80.0070.06011.03
5.2.70.0000.03311.11
5.2.60.0030.04711.22
5.2.50.0070.03311.09
5.2.40.0030.06011.05
5.2.30.0100.03710.99
5.2.20.0100.04710.90
5.2.10.0030.04011.02
5.2.00.0030.02710.80
5.1.60.0030.02310.08
5.1.50.0030.02310.07
5.1.40.0030.02710.04
5.1.30.0030.02710.52
5.1.20.0030.02310.37
5.1.10.0030.02310.14
5.1.00.0030.02310.11
5.0.50.0000.0208.63
5.0.40.0030.0178.49
5.0.30.0070.0238.49
5.0.20.0000.0208.49
5.0.10.0030.0208.49
5.0.00.0000.0308.49
4.4.90.0000.0238.49
4.4.80.0030.0178.49
4.4.70.0030.0178.49
4.4.60.0000.0178.49
4.4.50.0070.0108.49
4.4.40.0000.0278.49
4.4.30.0030.0138.49
4.4.20.0000.0178.49
4.4.10.0030.0138.49
4.4.00.0030.0238.49
4.3.110.0030.0138.49
4.3.100.0000.0138.49
4.3.90.0070.0078.49
4.3.80.0030.0208.49
4.3.70.0030.0108.49
4.3.60.0000.0208.49
4.3.50.0070.0108.49
4.3.40.0000.0238.49
4.3.30.0000.0178.49
4.3.20.0000.0208.49
4.3.10.0100.0108.49
4.3.00.0000.0138.49

preferences:
35.85 ms | 403 KiB | 5 Q