3v4l.org

run code in 300+ PHP versions simultaneously
<?php function expandArguments(&$query, &$args) { $modified = FALSE; foreach (array_filter($args, 'is_array') as $key => $data) { $new_keys = array(); foreach ($data as $i => $value) { $new_keys[$key . '_' . $i] = $value; } $query = preg_replace( '#' . $key . '\b#', implode(', ', array_keys($new_keys)), $query ); unset($args[$key]); $args += $new_keys; $modified = TRUE; } return $modified; } function expandArguments2(&$query, &$args) { $modified = FALSE; foreach (array_filter($args, 'is_array') as $key => $data) { $new_keys = array(); foreach (array_values($data) as $i => $value) { $new_keys[$key . '_' . $i] = $value; } $query = preg_replace( '#' . $key . '\b#', implode(', ', array_keys($new_keys)), $query ); unset($args[$key]); $args += $new_keys; $modified = TRUE; } return $modified; } $query = "SELECT * FROM foo WHERE id IN (:ids)"; $args = array( 'ids' => array( 1, 2, '0); DROP TABLE foo; --' => 3 ) ); expandArguments($query, $args); var_dump($query, $args);

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.0080.01218.43
8.3.50.0110.00722.20
8.3.40.0040.01118.93
8.3.30.0100.00419.21
8.3.20.0080.00020.35
8.3.10.0040.00423.59
8.3.00.0070.01119.75
8.2.180.0040.01116.75
8.2.170.0110.00422.96
8.2.160.0170.00020.53
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0080.00022.25
8.2.110.0060.00320.29
8.2.100.0060.00618.09
8.2.90.0000.00818.16
8.2.80.0040.00417.97
8.2.70.0000.00918.00
8.2.60.0030.00618.05
8.2.50.0040.00418.07
8.2.40.0050.00518.28
8.2.30.0030.00518.18
8.2.20.0030.00517.80
8.2.10.0050.00318.24
8.2.00.0030.00517.85
8.1.280.0140.00725.92
8.1.270.0030.00622.26
8.1.260.0030.00626.35
8.1.250.0040.00428.09
8.1.240.0090.00023.78
8.1.230.0060.00621.02
8.1.220.0040.00417.74
8.1.210.0080.00019.08
8.1.200.0000.00917.60
8.1.190.0030.00517.48
8.1.180.0060.00318.10
8.1.170.0100.00018.75
8.1.160.0000.00822.06
8.1.150.0040.00418.95
8.1.140.0040.00417.50
8.1.130.0030.00317.93
8.1.120.0070.00017.55
8.1.110.0040.00417.70
8.1.100.0000.00717.64
8.1.90.0030.00817.68
8.1.80.0070.00017.70
8.1.70.0040.00417.64
8.1.60.0040.00417.65
8.1.50.0050.00517.61
8.1.40.0000.00817.69
8.1.30.0040.00417.85
8.1.20.0080.00017.74
8.1.10.0040.00417.74
8.1.00.0040.00417.72
8.0.300.0040.00420.21
8.0.290.0000.00917.13
8.0.280.0000.00718.38
8.0.270.0070.00017.25
8.0.260.0030.00317.31
8.0.250.0050.00317.18
8.0.240.0000.00717.10
8.0.230.0000.00717.12
8.0.220.0080.00017.13
8.0.210.0070.00017.11
8.0.200.0060.00017.16
8.0.190.0000.00717.11
8.0.180.0040.00417.06
8.0.170.0000.00817.20
8.0.160.0030.00317.23
8.0.150.0000.00717.05
8.0.140.0000.00817.08
8.0.130.0000.00613.52
8.0.120.0080.00016.98
8.0.110.0000.00717.20
8.0.100.0030.00517.25
8.0.90.0040.00416.95
8.0.80.0090.00917.08
8.0.70.0040.00417.12
8.0.60.0000.00817.20
8.0.50.0000.00717.12
8.0.30.0130.00917.18
8.0.20.0130.00517.52
8.0.10.0030.00517.23
8.0.00.0060.01116.93
7.4.330.0000.00815.02
7.4.320.0000.00616.74
7.4.300.0030.00316.76
7.4.290.0000.00716.70
7.4.280.0030.00616.73
7.4.270.0040.00416.75
7.4.260.0100.00016.82
7.4.250.0040.00416.67
7.4.240.0040.00316.77
7.4.230.0040.00416.96
7.4.220.0090.00916.84
7.4.210.0110.00716.82
7.4.200.0030.00516.68
7.4.160.0100.00716.67
7.4.150.0090.01217.40
7.4.140.0100.01017.86
7.4.130.0100.00716.88
7.4.120.0100.00716.87
7.4.110.0150.00416.96
7.4.100.0070.01016.70
7.4.90.0090.00916.82
7.4.80.0120.01219.39
7.4.70.0030.01616.82
7.4.60.0070.01016.59
7.4.50.0070.00316.63
7.4.40.0110.00716.72
7.4.30.0120.00616.70
7.4.00.0090.00615.29
7.3.330.0060.00013.32
7.3.320.0000.00513.40
7.3.310.0000.00716.39
7.3.300.0030.00316.54
7.3.290.0060.01016.52
7.3.280.0090.01016.52
7.3.270.0110.00717.40
7.3.260.0060.01016.68
7.3.250.0150.00816.64
7.3.240.0110.00716.64
7.3.230.0130.01016.71
7.3.210.0080.01116.90
7.3.200.0120.00919.39
7.3.190.0080.00816.53
7.3.180.0060.01516.48
7.3.170.0080.00816.53
7.3.160.0060.01016.61
7.3.10.0040.01116.55
7.3.00.0060.00616.90
7.2.330.0140.00516.94
7.2.320.0080.00816.80
7.2.310.0120.00416.65
7.2.300.0130.00316.86
7.2.290.0070.01616.86
7.2.130.0140.00716.91
7.2.120.0030.01317.17
7.2.110.0100.00716.94
7.2.100.0040.01217.17
7.2.90.0050.01017.30
7.2.80.0140.00717.13
7.2.70.0110.01116.89
7.2.60.0120.00417.15
7.2.50.0000.00816.98
7.2.40.0100.00717.19
7.2.30.0090.00616.76
7.2.20.0060.00916.93
7.2.10.0070.00417.21
7.2.00.0040.00618.45
7.1.250.0040.00716.10
7.1.100.0140.01416.59
7.1.70.0000.00717.21
7.1.60.0190.00417.69
7.1.50.0090.01317.24
7.1.00.0070.07322.32
7.0.200.0110.00716.89
7.0.140.0030.07322.08
7.0.60.0030.04319.94
7.0.50.0030.08317.81
7.0.40.0030.05020.29
7.0.30.0500.05020.41
7.0.20.0200.04020.13
7.0.10.0030.08020.07
7.0.00.0030.04020.07
5.6.280.0030.07021.05
5.6.210.0030.04020.48
5.6.200.0130.07318.13
5.6.190.0100.07020.66
5.6.180.0270.08020.68
5.6.170.0330.07020.57
5.6.160.0000.04320.47
5.6.150.0000.04718.25
5.6.140.0100.06018.17
5.6.130.0030.08018.18
5.6.120.0170.03721.01
5.6.110.0030.04320.98
5.6.100.0070.07320.99
5.6.90.0070.04321.01
5.6.80.0100.07320.53
5.6.70.4170.04020.53
5.5.350.0330.07320.41
5.5.340.0070.08317.95
5.5.330.0170.07320.41
5.5.320.0300.04020.36
5.5.310.0430.07020.34
5.5.300.0000.04718.08
5.5.290.0100.05318.05
5.5.280.0100.04720.90
5.5.270.0070.07720.89
5.5.260.0100.07020.65
5.5.250.0030.07020.59
5.5.240.0170.08320.38
5.4.450.0730.06719.59
5.4.440.1030.08019.17
5.4.430.0670.05719.70
5.4.420.1170.08019.68
5.4.410.0700.06019.57
5.4.400.0770.05019.14
5.4.390.1030.07019.26
5.4.380.0970.06319.15
5.4.370.0830.06719.06
5.4.360.0900.05019.28
5.4.350.0930.06018.87
5.4.340.0050.03412.02
5.4.320.0040.03612.51
5.4.310.0030.04012.50
5.4.300.0030.04712.51
5.4.290.0060.03712.50
5.4.280.0040.03612.40
5.4.270.0060.03512.40
5.4.260.0020.04012.41
5.4.250.0010.04212.40
5.4.240.0050.03712.41
5.4.230.0070.03512.39
5.4.220.0060.03512.40
5.4.210.0060.04712.39
5.4.200.0100.03512.39
5.4.190.0080.03512.39
5.4.180.0090.04012.39
5.4.170.0070.04012.40
5.4.160.0040.04012.39
5.4.150.0040.04012.39
5.4.140.0050.03612.07
5.4.130.0040.04212.06
5.4.120.0070.03712.02
5.4.110.0060.03312.02
5.4.100.0030.03512.02
5.4.90.0020.04712.02
5.4.80.0060.03612.02
5.4.70.0010.03812.02
5.4.60.0050.03712.01
5.4.50.0090.03612.01
5.4.40.0030.03612.00
5.4.30.0050.03512.00
5.4.20.0050.03512.00
5.4.10.0050.03412.00
5.4.00.0040.04811.48
5.3.290.0060.04612.80
5.3.280.0060.03912.71
5.3.270.0110.04312.72
5.3.260.0050.04112.72
5.3.250.0050.03712.72
5.3.240.0050.03712.72
5.3.230.0060.04012.71
5.3.220.0050.04012.68
5.3.210.0070.03612.68
5.3.200.0060.03512.68
5.3.190.0050.03812.68
5.3.180.0020.03912.68
5.3.170.0090.03512.67
5.3.160.0110.03012.68
5.3.150.0100.04012.67
5.3.140.0080.03312.66
5.3.130.0050.04512.66
5.3.120.0030.04412.66
5.3.110.0040.03812.66
5.3.100.0040.03812.14
5.3.90.0060.03512.12
5.3.80.0100.04012.11
5.3.70.0030.03812.11
5.3.60.0050.03512.09
5.3.50.0050.03712.05
5.3.40.0040.03712.04
5.3.30.0040.03612.00
5.3.20.0020.03811.79
5.3.10.0080.03611.75
5.3.00.0060.03411.74
5.2.170.0010.0339.23
5.2.160.0100.0289.24
5.2.150.0040.0299.23
5.2.140.0040.0299.23
5.2.130.0060.0349.20
5.2.120.0050.0329.19
5.2.110.0060.0279.20
5.2.100.0030.0319.20
5.2.90.0040.0299.20
5.2.80.0050.0299.19
5.2.70.0040.0309.20
5.2.60.0060.0309.15
5.2.50.0070.0279.12
5.2.40.0050.0279.10
5.2.30.0050.0289.07
5.2.20.0030.0309.06
5.2.10.0040.0288.95
5.2.00.0020.0308.82
5.1.60.0040.0238.10
5.1.50.0050.0238.10
5.1.40.0040.0248.07
5.1.30.0050.0288.43
5.1.20.0020.0278.45
5.1.10.0000.0298.18
5.1.00.0040.0258.18
5.0.50.0010.0236.67
5.0.40.0030.0196.53
5.0.30.0040.0316.34
5.0.20.0040.0186.30
5.0.10.0040.0196.29
5.0.00.0010.0336.27
4.4.90.0040.0194.78
4.4.80.0030.0174.75
4.4.70.0040.0134.75
4.4.60.0010.0164.75
4.4.50.0020.0154.77
4.4.40.0020.0244.70
4.4.30.0020.0154.76
4.4.20.0080.0144.85
4.4.10.0030.0174.85
4.4.00.0030.0244.76
4.3.110.0010.0194.67
4.3.100.0060.0114.66
4.3.90.0030.0144.63
4.3.80.0010.0254.58
4.3.70.0020.0154.63
4.3.60.0030.0144.63
4.3.50.0040.0144.63
4.3.40.0020.0244.53
4.3.30.0040.0143.33
4.3.20.0020.0163.31
4.3.10.0040.0173.26
4.3.00.0100.0277.21

preferences:
41.4 ms | 401 KiB | 5 Q