3v4l.org

run code in 300+ PHP versions simultaneously
<?php function init(&$select, &$params){ $select = array('key'=>1, 'key2'=>'one', 'key3'=>3333.333); $params = array(); } //echo 'array_walk: '; init($select, $params); $start_time = microtime(TRUE); array_walk($select, function(&$val, $id) { $params[$id] = $val; $val = "{$id} = :{$id}"; }); $end_time = microtime(TRUE); $walk_time = $end_time - $start_time; //echo 'foreach: '; init($select, $params); $start_time = microtime(TRUE); foreach($select as $id => &$val){ $params[$id] = $val; $val = "{$id} = :{$id}"; }unset($val); $end_time = microtime(TRUE); $foreach_time = $end_time - $start_time; echo "<pre> ArrayWalk Time: ".sprintf('%.10F', $walk_time)." Foreach Time: ".sprintf('%.10F', $foreach_time)." array_walk > foreach: ".($walk_time > $foreach_time)." foreach > array_walk ".($foreach_time > $walk_time)."</pre>";

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)
7.2.00.0060.00619.54
7.1.70.0000.00717.20
7.1.60.0120.01219.40
7.1.50.0060.00617.11
7.1.00.0000.05022.52
7.0.200.0040.00416.77
7.0.140.0070.07022.00
7.0.120.0030.07722.15
7.0.60.0200.07021.66
7.0.50.0130.07017.87
7.0.40.0100.09020.04
7.0.30.0170.04020.27
7.0.20.0200.06020.40
7.0.10.0170.08720.14
7.0.00.0230.05320.23
5.6.280.0030.07321.07
5.6.210.0130.05720.77
5.6.200.0070.04318.20
5.6.190.0230.03720.41
5.6.180.0130.06720.48
5.6.170.0170.05720.62
5.6.160.0200.07020.60
5.6.150.0270.04020.41
5.6.140.0200.04320.34
5.6.130.0230.03720.18
5.6.120.0170.04320.52
5.6.110.0170.04020.20
5.6.100.0230.03720.40
5.6.90.0230.03320.15
5.6.80.0130.04019.56
5.6.70.0300.03719.57
5.6.60.0130.04019.81
5.6.50.0070.06319.57
5.6.40.0100.04319.88
5.6.30.0200.03319.53
5.6.20.0230.04019.69
5.6.10.0200.04719.54
5.6.00.0230.07319.67
5.5.350.0200.07020.34
5.5.340.0070.08317.94
5.5.330.0270.05020.40
5.5.320.0130.05020.21
5.5.310.0200.03320.37
5.5.300.0270.07020.14
5.5.290.0430.04720.13
5.5.280.0230.08320.14
5.5.270.0100.05719.96
5.5.260.0130.04720.13
5.5.250.0130.04319.96
5.5.240.0170.08319.54
5.5.230.0130.04019.68
5.5.220.0170.06319.67
5.5.210.0170.03719.46
5.5.200.0130.04319.34
5.5.190.0130.04319.65
5.5.180.0130.04019.56
5.5.160.0230.05319.55
5.5.150.0230.05719.68
5.5.140.0230.04319.49
5.5.130.0200.07019.32
5.5.120.0270.06719.52
5.5.110.0300.05719.55
5.5.100.0300.07019.25
5.5.90.0370.06719.59
5.5.80.0330.06019.39
5.5.70.0230.05019.45
5.5.60.0200.06019.27
5.5.50.0200.03319.20
5.5.40.0400.04719.37
5.5.30.0100.04719.44
5.5.20.0200.08019.28
5.5.10.0200.07019.42
5.5.00.0300.06319.27
5.4.450.0230.07319.57
5.4.440.0300.04719.58
5.4.430.0270.02719.58
5.4.420.0170.04019.57
5.4.410.0200.03019.45
5.4.400.0230.06719.16
5.4.390.0130.04719.16
5.4.380.0130.03718.98
5.4.370.0100.04019.25
5.4.360.0130.03718.96
5.4.350.0230.05019.21
5.4.340.0170.04319.25
5.4.320.0200.04318.86
5.4.310.0130.04318.98
5.4.300.0330.06019.00
5.4.290.0100.07019.07
5.4.280.0300.07319.14
5.4.270.0130.05019.14
5.4.260.0230.07318.92
5.4.250.0170.06318.85
5.4.240.0370.06019.14
5.4.230.0270.05318.98
5.4.220.0270.05018.85
5.4.210.0130.04318.87
5.4.200.0330.04719.22
5.4.190.0200.04019.23
5.4.180.0230.03319.23
5.4.170.0200.07318.99
5.4.160.0200.03719.09
5.4.150.0170.04019.18
5.4.140.0170.04016.47
5.4.130.0170.05016.40
5.4.120.0170.07016.45
5.4.110.0270.03716.39
5.4.100.0330.05316.50
5.4.90.0230.07316.50
5.4.80.0270.07316.63
5.4.70.0300.06716.38
5.4.60.0170.05016.47
5.4.50.0200.07716.45
5.4.40.0230.06316.36
5.4.30.0200.07316.40
5.4.20.0230.06316.39
5.4.10.0200.05016.40
5.4.00.0270.06315.90
5.3.290.0230.07014.69
5.3.280.0200.06714.60
5.3.270.0200.03714.62
5.3.260.0230.04014.77
5.3.250.0200.03714.50
5.3.240.0170.07714.55
5.3.230.0200.05314.64
5.3.220.0230.07314.66
5.3.210.0200.07714.57
5.3.200.0200.04714.63
5.3.190.0200.04714.63
5.3.180.0200.07314.52
5.3.170.0230.06014.71
5.3.160.0300.05014.63
5.3.150.0170.08014.58
5.3.140.0230.07314.45
5.3.130.0330.07014.58
5.3.120.0200.07714.58
5.3.110.0200.06014.55
5.3.100.0300.05714.04
5.3.90.0300.06014.04
5.3.80.0300.06014.18
5.3.70.0200.05314.02
5.3.60.0270.06714.01
5.3.50.0230.05313.90
5.3.40.0300.04314.01
5.3.30.0270.06013.84
5.3.20.0230.05013.74
5.3.10.0230.05013.80
5.3.00.0200.07013.68
5.2.170.0230.05712.50
5.2.160.0170.05012.50
5.2.150.0230.03712.50
5.2.140.0200.06012.50
5.2.130.0170.06712.50
5.2.120.0200.04012.50
5.2.110.0200.04012.50
5.2.100.0130.03312.50
5.2.90.0200.05712.50
5.2.80.0130.03012.50
5.2.70.0100.03012.50
5.2.60.0130.02712.50
5.2.50.0130.02712.50
5.2.40.0030.03312.50
5.2.30.0130.04312.50
5.2.20.0130.05312.50
5.2.10.0170.05312.50
5.2.00.0170.05712.50
5.1.60.0200.03012.50
5.1.50.0130.03312.50
5.1.40.0130.04012.50
5.1.30.0100.03312.50
5.1.20.0170.04312.50
5.1.10.0100.05012.50
5.1.00.0170.05012.50
5.0.50.0130.02312.50
5.0.40.0100.04312.50
5.0.30.0100.06712.50
5.0.20.0130.03712.50
5.0.10.0100.04012.50
5.0.00.0100.06312.50
4.4.90.0070.01312.50
4.4.80.0030.02012.50
4.4.70.0000.02712.50
4.4.60.0070.03312.50
4.4.50.0100.02312.50
4.4.40.0070.05012.50
4.4.30.0070.03712.50
4.4.20.0100.03312.50
4.4.10.0070.03012.50
4.4.00.0030.02712.50
4.3.110.0100.02712.50
4.3.100.0170.02712.50
4.3.90.0070.03312.50
4.3.80.0070.02712.50
4.3.70.0170.02312.50
4.3.60.0130.02712.50
4.3.50.0100.02312.50
4.3.40.0170.03312.50
4.3.30.0030.02012.50
4.3.20.0000.02012.50
4.3.10.0070.01712.50
4.3.00.0030.03712.50

preferences:
36.76 ms | 401 KiB | 5 Q