3v4l.org

run code in 300+ PHP versions simultaneously
3<?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; } $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.0090.00618.58
8.3.50.0140.00522.12
8.3.40.0070.00719.02
8.3.30.0070.00719.17
8.3.20.0040.00420.33
8.3.10.0060.00323.57
8.3.00.0080.00019.50
8.2.180.0070.00716.88
8.2.170.0040.01122.96
8.2.160.0140.00020.35
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00422.34
8.2.110.0030.00622.08
8.2.100.0060.00617.88
8.2.90.0000.00819.17
8.2.80.0060.00317.97
8.2.70.0000.01017.63
8.2.60.0040.00418.04
8.2.50.0030.00518.07
8.2.40.0080.00018.17
8.2.30.0000.00818.18
8.2.20.0080.00017.84
8.2.10.0000.00818.04
8.2.00.0040.00417.98
8.1.280.0090.01225.92
8.1.270.0060.00322.02
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0000.00923.92
8.1.230.0040.00719.09
8.1.220.0000.00717.74
8.1.210.0040.00418.77
8.1.200.0110.00017.48
8.1.190.0040.00417.35
8.1.180.0000.00818.10
8.1.170.0080.00418.68
8.1.160.0030.00622.01
8.1.150.0070.00018.95
8.1.140.0050.00317.63
8.1.130.0030.00317.79
8.1.120.0070.00017.57
8.1.110.0000.00717.70
8.1.100.0000.00717.49
8.1.90.0040.00717.63
8.1.80.0000.00717.54
8.1.70.0030.00317.48
8.1.60.0000.00917.75
8.1.50.0080.00017.73
8.1.40.0080.00017.72
8.1.30.0030.00617.87
8.1.20.0000.00817.86
8.1.10.0000.00817.65
8.1.00.0040.00417.59
8.0.300.0040.00418.77
8.0.290.0000.01016.88
8.0.280.0040.00418.47
8.0.270.0040.00417.27
8.0.260.0000.00717.23
8.0.250.0030.00317.21
8.0.240.0060.00017.21
8.0.230.0030.00317.24
8.0.220.0070.00017.02
8.0.210.0030.00317.03
8.0.200.0000.00717.18
8.0.190.0000.00717.05
8.0.180.0040.00417.16
8.0.170.0080.00017.05
8.0.160.0040.00417.14
8.0.150.0040.00417.00
8.0.140.0050.00316.96
8.0.130.0030.00313.55
8.0.120.0030.00616.98
8.0.110.0030.00517.03
8.0.100.0040.00417.01
8.0.90.0000.00717.00
8.0.80.0070.01017.14
8.0.70.0040.00416.96
8.0.60.0020.00517.01
8.0.50.0040.00417.16
8.0.30.0140.00717.24
8.0.20.0090.00917.40
8.0.10.0030.00517.33
8.0.00.0120.00617.00
7.4.330.0030.00315.02
7.4.320.0030.00316.75
7.4.300.0050.00316.72
7.4.290.0070.00016.64
7.4.280.0080.00016.73
7.4.270.0000.00716.84
7.4.260.0090.00016.71
7.4.250.0040.00416.85
7.4.240.0030.00416.81
7.4.230.0030.00316.94
7.4.220.0070.01116.80
7.4.210.0090.00616.80
7.4.200.0030.00316.84
7.4.160.0100.00716.83
7.4.150.0140.00417.40
7.4.140.0140.00717.86
7.4.130.0120.00816.69
7.4.120.0090.01116.65
7.4.110.0080.00816.73
7.4.100.0170.00016.65
7.4.90.0070.01016.55
7.4.80.0120.00619.39
7.4.70.0100.01016.96
7.4.60.0150.00616.78
7.4.50.0040.00416.80
7.4.40.0080.00816.68
7.4.30.0120.00616.59
7.4.00.0060.01015.31
7.3.330.0030.00313.39
7.3.320.0000.00613.40
7.3.310.0000.00716.53
7.3.300.0000.00716.41
7.3.290.0080.00716.52
7.3.280.0100.00716.51
7.3.270.0140.01017.40
7.3.260.0110.00616.56
7.3.250.0100.00716.59
7.3.240.0100.01016.63
7.3.230.0100.00616.51
7.3.210.0070.01016.64
7.3.200.0170.00419.39
7.3.190.0100.01316.61
7.3.180.0060.01016.89
7.3.170.0060.01016.63
7.3.160.0120.00616.84
7.2.330.0120.00916.63
7.2.320.0190.00616.75
7.2.310.0120.00416.84
7.2.300.0030.01316.93
7.2.290.0130.00616.83
7.2.00.0060.01019.79
7.1.100.0180.00616.73
7.1.70.0050.00217.54
7.1.60.0100.01019.32
7.1.50.0030.00917.16
7.1.00.0070.07322.45
7.0.200.0050.00317.06
7.0.140.0000.07722.18
7.0.60.0070.07721.59
7.0.50.0030.04317.98
7.0.40.0170.07320.25
7.0.30.0200.05320.12
7.0.20.0270.07720.35
7.0.10.0070.04320.35
7.0.00.0030.04720.34
5.6.280.0030.07721.15
5.6.210.0070.04020.48
5.6.200.0100.05318.29
5.6.190.0100.08720.61
5.6.180.0470.07720.47
5.6.170.0270.07720.71
5.6.160.0100.03720.44
5.6.150.0100.07718.16
5.6.140.0070.08318.18
5.6.130.0100.06018.14
5.6.120.0030.04321.20
5.6.110.0100.04020.99
5.6.100.0100.07320.98
5.6.90.0130.08021.00
5.6.80.0070.04720.41
5.5.350.4030.04020.39
5.5.340.0130.06717.94
5.5.330.0070.05720.27
5.5.320.0430.04320.35
5.5.310.0270.07720.32
5.5.300.0070.05317.92
5.5.290.0070.03717.95
5.5.280.0070.08020.77
5.5.270.0100.08020.77
5.5.260.0070.04020.89
5.5.250.0070.04020.50
5.5.240.0130.07020.27
5.4.450.3630.05019.30
5.4.440.0070.07719.28
5.4.430.1330.08019.45
5.4.420.3400.03019.25
5.4.410.3870.03319.36
5.4.400.3600.04319.15
5.4.390.0800.03719.04
5.4.380.0800.03719.22
5.4.370.2370.03719.23
5.4.360.1830.04018.95
5.4.350.1230.04019.17
5.4.340.2700.03319.13
5.4.320.2000.04019.17
5.4.310.1830.03719.16
5.4.300.3830.04019.06
5.4.290.3600.05019.22
5.4.280.3200.04019.01
5.4.270.4000.03018.93
5.4.260.4700.04319.24
5.4.250.3500.03319.22
5.4.240.3930.03019.07
5.4.230.3870.04318.98
5.4.220.3630.03719.23
5.4.210.3770.03318.93
5.4.200.3930.04019.10
5.4.190.4270.03719.09
5.4.180.3800.04319.12
5.4.170.3800.04319.11
5.4.160.3100.03718.96
5.4.150.2770.04019.23
5.4.140.2200.03716.44
5.4.130.3000.03316.55
5.4.120.3170.04016.39
5.4.110.3000.03316.56
5.4.100.1470.05716.37
5.4.90.1800.04016.61
5.4.80.2730.03316.55
5.4.70.2670.04016.39
5.4.60.2600.03716.53
5.4.50.3300.04316.45
5.4.40.2930.03016.42
5.4.30.2870.03016.52
5.4.20.3400.03316.45
5.4.10.3470.03316.50
5.4.00.3670.04015.85
5.3.290.1030.04014.70
5.3.280.3770.04014.60
5.3.270.3600.04314.64
5.3.260.3400.03714.68
5.3.250.2970.03014.67
5.3.240.2370.04314.49
5.3.230.2000.04014.63
5.3.220.2070.04314.71
5.3.210.1500.05314.57
5.3.200.2500.03014.61
5.3.190.1900.05314.45
5.3.180.2830.04014.45
5.3.170.3230.04314.71
5.3.160.2970.04014.59
5.3.150.2870.03314.60
5.3.140.3270.04014.57
5.3.130.3830.04714.60
5.3.120.3270.04014.54
5.3.110.3530.03714.57
5.3.100.3770.04714.21
5.3.90.2800.03314.03
5.3.80.3500.03714.04
5.3.70.3000.04014.07
5.3.60.3570.03714.00
5.3.50.3200.03713.97
5.3.40.3470.03713.97
5.3.30.3230.03013.98
5.3.20.4000.03313.85
5.3.10.3170.04013.71
5.3.00.3700.04013.64
5.2.170.2000.03011.20
5.2.160.2630.03311.17
5.2.150.2770.03311.07
5.2.140.2800.03011.22
5.2.130.3070.02711.16
5.2.120.3270.02711.00
5.2.110.3100.02711.05
5.2.100.2900.03011.15
5.2.90.2600.02711.07
5.2.80.3330.02311.13
5.2.70.2900.02711.07
5.2.60.2430.03011.08
5.2.50.3070.02711.03
5.2.40.2170.03011.04
5.2.30.2430.03711.04
5.2.20.2570.03011.01
5.2.10.2570.03011.01
5.2.00.2570.03010.73
5.1.60.2570.02710.15
5.1.50.2530.02710.15
5.1.40.2570.02310.12
5.1.30.2330.02310.35
5.1.20.2030.02710.50
5.1.10.2700.0309.98
5.1.00.2470.02310.04
5.0.50.1500.0208.47
5.0.40.1030.0178.38
5.0.30.1000.0338.29
5.0.20.1170.0238.26
5.0.10.1570.0238.20
5.0.00.1330.0308.21
4.4.90.1130.0175.90
4.4.80.1030.0205.91
4.4.70.1230.0175.93
4.4.60.1470.0205.93
4.4.50.1430.0205.93
4.4.40.1170.0235.93
4.4.30.1530.0105.93
4.4.20.1170.0235.93
4.4.10.1470.0135.97
4.4.00.1170.0275.97
4.3.110.1370.0205.97
4.3.100.1300.0175.97
4.3.90.1000.0135.97
4.3.80.1170.0235.97
4.3.70.1270.0075.97
4.3.60.1370.0235.97
4.3.50.1130.0175.97
4.3.40.1670.0305.97
4.3.30.0770.0135.97
4.3.20.0530.0275.97
4.3.10.0830.0135.97
4.3.00.0670.0175.97

preferences:
44.69 ms | 401 KiB | 5 Q