3v4l.org

run code in 300+ PHP versions simultaneously
<?php function pdo_named_in_clause_from_array($array, $name = 'in') { $in = $data = array(); $i = 0; // Check that the placeholder names we will produce will be valid $name = preg_replace('/[^a-z0-9_]+/', '', (string)$name); if (!preg_match('/^[a-z]/i', $name)) { throw new \InvalidArgumentException('Placeholder name ' . $name . ': must begin with a letter'); } // Build an array of placeholder names and a map of placeholders => values foreach ($array as $value) { $key = $name . $i++; $in[] = ':' . $key; $data[$key] = $value; } // Collapse placeholder names to comma separated string and return it along with the data return array(implode(', ', $in), $data); } // The data to go into the IN clause $inList = [1, 2, 3]; // Prepare the IN clause data for use list($inClause, $inData) = pdo_named_in_clause_from_array($inList, 'id'); // Build the query string $query = " UPDATE table SET value1 = :val1, value2 = :val2 WHERE id IN (" . $inClause . ") "; // Create the data array. Get an array of concrete values and merge the IN clause data $data = array('val1' => 'Hello', 'val2' => 'World') + $inData; var_dump($query, $data); /* $stmt = $db->prepare($query); $stmt->execute($data); */

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.0070.00718.55
8.3.50.0120.00618.24
8.3.40.0150.00719.13
8.3.30.0110.00419.19
8.3.20.0000.00820.29
8.3.10.0060.00323.61
8.3.00.0060.00319.50
8.2.180.0070.01116.75
8.2.170.0090.00622.96
8.2.160.0140.00720.43
8.2.150.0030.00524.18
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0110.00422.32
8.2.110.0030.00622.25
8.2.100.0120.00017.88
8.2.90.0050.00319.25
8.2.80.0030.00618.00
8.2.70.0030.00617.88
8.2.60.0000.00817.93
8.2.50.0080.00018.07
8.2.40.0030.00519.95
8.2.30.0080.00018.12
8.2.20.0000.00918.00
8.2.10.0050.00218.21
8.2.00.0060.00317.91
8.1.270.0060.00322.07
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0060.00323.83
8.1.230.0080.00317.61
8.1.220.0090.00017.91
8.1.210.0000.00818.77
8.1.200.0040.00417.25
8.1.190.0040.00417.38
8.1.180.0030.00518.10
8.1.170.0040.00418.84
8.1.160.0080.00022.02
8.1.150.0040.00418.97
8.1.140.0000.00817.75
8.1.130.0000.00717.89
8.1.120.0000.00717.65
8.1.110.0000.00817.67
8.1.100.0000.00717.61
8.1.90.0040.00417.66
8.1.80.0040.00417.64
8.1.70.0030.00317.62
8.1.60.0040.00417.73
8.1.50.0030.00617.66
8.1.40.0040.00417.67
8.1.30.0030.00517.85
8.1.20.0050.00317.80
8.1.10.0080.00017.62
8.1.00.0000.00717.56
8.0.300.0080.00018.77
8.0.290.0000.00817.00
8.0.280.0000.00718.44
8.0.270.0000.00717.36
8.0.260.0000.00617.25
8.0.250.0030.00317.13
8.0.240.0040.00417.14
8.0.230.0030.00317.07
8.0.220.0030.00317.14
8.0.210.0030.00317.13
8.0.200.0000.00617.13
8.0.190.0040.00417.23
8.0.180.0030.00617.14
8.0.170.0040.00417.21
8.0.160.0000.00716.98
8.0.150.0040.00417.05
8.0.140.0000.00717.05
8.0.130.0000.00713.62
8.0.120.0000.00816.99
8.0.110.0040.00417.01
8.0.100.0030.00517.07
8.0.90.0050.00216.97
8.0.80.0090.00617.10
8.0.70.0040.00417.21
8.0.60.0040.00417.05
8.0.50.0070.00017.12
8.0.30.0110.00917.42
8.0.20.0140.00917.40
8.0.10.0040.00417.21
8.0.00.0090.00817.18
7.4.330.0030.00315.02
7.4.320.0000.00916.75
7.4.300.0020.00516.76
7.4.290.0040.00416.64
7.4.280.0060.00616.76
7.4.270.0030.00516.73
7.4.260.0070.00016.88
7.4.250.0000.01016.84
7.4.240.0020.00616.80
7.4.230.0030.00316.95
7.4.220.0030.01616.95
7.4.210.0060.01016.89
7.4.200.0070.00016.97
7.4.160.0000.01616.86
7.4.150.0140.00717.40
7.4.140.0140.00617.86
7.4.130.0110.00616.79
7.4.120.0100.00716.93
7.4.110.0100.00716.70
7.4.100.0120.00616.73
7.4.90.0100.00716.63
7.4.80.0120.00619.39
7.4.70.0170.00716.68
7.4.60.0120.00616.79
7.4.50.0040.00416.70
7.4.40.0070.01016.59
7.4.30.0090.00816.77
7.4.00.0030.01315.11
7.3.330.0030.00313.41
7.3.320.0000.00613.41
7.3.310.0030.00716.50
7.3.300.0070.00016.56
7.3.290.0100.00616.55
7.3.280.0120.00616.54
7.3.270.0090.00917.40
7.3.260.0090.01016.60
7.3.250.0120.00516.68
7.3.240.0070.01016.88
7.3.230.0130.01016.61
7.3.210.0120.00416.59
7.3.200.0060.01219.39
7.3.190.0060.01216.57
7.3.180.0040.01216.50
7.3.170.0150.00316.73
7.3.160.0100.00716.80
7.2.330.0110.00716.91
7.2.320.0030.01516.89
7.2.310.0100.00716.86
7.2.300.0130.00316.93
7.2.290.0120.00616.82
7.2.60.0030.01017.31
7.1.200.0090.00315.77
7.1.100.0030.00918.20
7.1.70.0100.00017.44
7.1.60.0060.00919.11
7.1.50.0060.01817.16
7.1.00.0070.07322.52
7.0.200.0000.00717.04
7.0.140.0070.06722.08
7.0.60.0100.05019.97
7.0.50.0030.05317.91
7.0.40.0070.08020.15
7.0.30.0270.04720.27
7.0.20.0370.04720.26
7.0.10.0030.05320.18
7.0.00.0000.04720.08
5.6.280.0000.07720.86
5.6.210.0030.04320.77
5.6.200.0070.04318.29
5.6.190.0030.04320.77
5.6.180.0270.06720.54
5.6.170.0300.07720.54
5.6.160.0130.07720.61
5.6.150.0070.07718.15
5.6.140.0070.08318.20
5.6.130.0030.08318.16
5.6.120.0070.08721.13
5.6.110.0070.08321.00
5.6.100.0070.04720.96
5.6.90.0030.07720.95
5.6.80.0030.05320.51
5.6.70.3470.02720.40
5.5.350.0130.08320.29
5.5.340.0200.04718.02
5.5.330.0130.07020.21
5.5.320.0070.07320.32
5.5.310.0300.05720.30
5.5.300.0170.07017.92
5.5.290.0100.03718.07
5.5.280.0100.07720.81
5.5.270.0100.08320.68
5.5.260.0000.09320.80
5.5.250.0070.07720.58
5.5.240.0170.03020.19
5.4.450.1070.04319.56
5.4.440.0670.06719.47
5.4.430.1000.06019.58
5.4.420.0630.00019.21
5.4.410.0630.00019.41
5.4.400.0630.00019.25
5.4.390.0600.00019.09
5.4.380.0630.00019.13
5.4.370.0700.00019.09
5.4.360.0600.00019.27
5.4.350.0670.00019.09
5.4.340.0070.03312.02
5.4.320.0070.03512.51
5.4.310.0080.03612.50
5.4.300.0050.03712.51
5.4.290.0030.04112.51
5.4.280.0030.03712.40
5.4.270.0080.03412.40
5.4.260.0030.04012.40
5.4.250.0080.03512.40
5.4.240.0060.03512.40
5.4.230.0070.03612.40
5.4.220.0040.04112.39
5.4.210.0090.03212.39
5.4.200.0050.03812.39
5.4.190.0020.04012.39
5.4.180.0070.03512.39
5.4.170.0080.03312.40
5.4.160.0050.03612.39
5.4.150.0080.03312.39
5.4.140.0100.03712.08
5.4.130.0050.03612.07
5.4.120.0050.03612.02
5.4.110.0050.03612.02
5.4.100.0030.03812.02
5.4.90.0060.03712.02
5.4.80.0060.04112.02
5.4.70.0030.03712.01
5.4.60.0060.03412.01
5.4.50.0030.03812.01
5.4.40.0090.03512.00
5.4.30.0040.03612.00
5.4.20.0070.03311.99
5.4.10.0080.03312.00
5.4.00.0080.03311.48
5.3.290.0060.03912.80
5.3.280.0060.03712.71
5.3.270.0080.03712.73
5.3.260.0070.03712.72
5.3.250.0070.03612.71
5.3.240.0090.03412.72
5.3.230.0090.03612.71
5.3.220.0090.03312.68
5.3.210.0090.03612.68
5.3.200.0100.03712.68
5.3.190.0060.04012.68
5.3.180.0090.03412.67
5.3.170.0070.03612.67
5.3.160.0030.03912.67
5.3.150.0030.04112.67
5.3.140.0050.03612.66
5.3.130.0040.04112.66
5.3.120.0070.04112.66
5.3.110.0070.03712.66
5.3.100.0060.03712.13
5.3.90.0050.03812.12
5.3.80.0060.03712.11
5.3.70.0050.03612.11
5.3.60.0030.03912.09
5.3.50.0060.03512.04
5.3.40.0060.03712.04
5.3.30.0040.03812.00
5.3.20.0060.03511.78
5.3.10.0050.03811.75
5.3.00.0040.04611.73
5.2.170.0040.0349.22
5.2.160.0080.0349.22
5.2.150.0040.0329.22
5.2.140.0050.0319.21
5.2.130.0070.0289.18
5.2.120.0060.0299.17
5.2.110.0050.0289.18
5.2.100.0020.0359.18
5.2.90.0070.0329.18
5.2.80.0040.0319.18
5.2.70.0070.0319.18
5.2.60.0050.0309.13
5.2.50.0050.0309.11
5.2.40.0050.0279.07
5.2.30.0050.0299.05
5.2.20.0050.0299.04
5.2.10.0050.0288.95
5.2.00.0030.0318.82
5.1.60.0050.0268.09
5.1.50.0020.0278.09
5.1.40.0070.0228.07
5.1.30.0070.0248.42
5.1.20.0090.0238.44
5.1.10.0060.0248.17
5.1.00.0030.0268.17
5.0.50.0030.0216.66
5.0.40.0020.0206.52
5.0.30.0040.0306.33
5.0.20.0030.0246.29
5.0.10.0050.0186.28
5.0.00.0010.0336.27
4.4.90.0030.0154.78
4.4.80.0010.0194.75
4.4.70.0040.0144.75
4.4.60.0030.0144.75
4.4.50.0030.0154.77
4.4.40.0050.0254.71
4.4.30.0050.0144.76
4.4.20.0010.0174.84
4.4.10.0040.0144.85
4.4.00.0020.0254.76
4.3.110.0030.0174.66
4.3.100.0010.0164.67
4.3.90.0040.0134.64
4.3.80.0030.0254.59
4.3.70.0020.0154.63
4.3.60.0040.0134.63
4.3.50.0020.0164.62
4.3.40.0020.0244.53
4.3.30.0030.0153.30
4.3.20.0030.0153.28
4.3.10.0030.0153.24
4.3.00.0170.0277.15

preferences:
59.62 ms | 400 KiB | 5 Q