3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $entries = []; for($i = 0; $i < 100000; $i++) { $entries[] = ['id' => $i]; } $t = microtime(true); $res = array_map(function($entry) { return $entry['id']; }, $entries); $t = microtime(true) - $t; echo number_format($t, 4) . 's / array_map()'; $t = microtime(true); $res = []; foreach($entries as $entry) { $res[] = $entry['id']; } $t = microtime(true) - $t; echo "\n"; echo number_format($t, 4) . 's / foreach';
based on MZnfH
Output for 7.1.0
0.0125s / array_map() 0.0113s / foreach
Output for 7.0.14
-0.0092s / array_map() -0.0103s / foreach
Output for 7.0.6
0.0147s / array_map() 0.0142s / foreach
Output for 7.0.5
0.0158s / array_map() 0.0132s / foreach
Output for 7.0.4
0.0153s / array_map() 0.0123s / foreach
Output for 7.0.3
0.0205s / array_map() 0.0196s / foreach
Output for 7.0.2
0.0190s / array_map() 0.0186s / foreach
Output for 7.0.1
0.0173s / array_map() 0.0129s / foreach
Output for 7.0.0
0.0136s / array_map() 0.0130s / foreach
Output for hhvm-3.12.0
0.0164s / array_map() 0.0074s / foreach
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.6.28
0.0517s / array_map() 0.0263s / foreach
Output for 5.6.21
0.0538s / array_map() 0.0256s / foreach
Output for 5.6.20
0.0537s / array_map() 0.0253s / foreach
Output for 5.6.19
0.0549s / array_map() 0.0261s / foreach
Output for 5.6.18
0.0472s / array_map() 0.0247s / foreach
Output for 5.6.17
0.0551s / array_map() 0.0247s / foreach
Output for 5.6.16
0.0482s / array_map() 0.0253s / foreach
Output for 5.6.15
0.0549s / array_map() 0.0258s / foreach
Output for 5.6.14
0.0495s / array_map() 0.0233s / foreach
Output for 5.6.13
0.0494s / array_map() 0.0245s / foreach
Output for 5.6.12
0.0555s / array_map() 0.0251s / foreach
Output for 5.6.11
0.0532s / array_map() 0.0244s / foreach
Output for 5.6.10
0.0527s / array_map() 0.0250s / foreach
Output for 5.6.9
0.0637s / array_map() 0.0305s / foreach
Output for 5.6.8
0.0567s / array_map() 0.0253s / foreach
Output for 5.6.7
0.0499s / array_map() 0.0257s / foreach
Output for 5.5.35
0.0505s / array_map() 0.0252s / foreach
Output for 5.5.34
0.0540s / array_map() 0.0261s / foreach
Output for 5.5.33
0.0760s / array_map() 0.0318s / foreach
Output for 5.5.32
0.0504s / array_map() 0.0259s / foreach
Output for 5.5.31
0.0477s / array_map() 0.0254s / foreach
Output for 5.5.30
0.0429s / array_map() 0.0231s / foreach
Output for 5.5.29
0.0476s / array_map() 0.0254s / foreach
Output for 5.5.28
0.0532s / array_map() 0.0264s / foreach
Output for 5.5.27
0.0470s / array_map() 0.0242s / foreach
Output for 5.5.26
0.0487s / array_map() 0.0261s / foreach
Output for 5.5.25
0.0528s / array_map() 0.0269s / foreach
Output for 5.5.24
0.0489s / array_map() 0.0267s / foreach
Output for 5.4.45
0.0584s / array_map() 0.0278s / foreach
Output for 5.4.44
0.1304s / array_map() 0.0463s / foreach
Output for 5.4.43
0.4294s / array_map() 0.1882s / foreach
Output for 5.4.42
0.0887s / array_map() 0.0562s / foreach
Output for 5.4.41
0.0687s / array_map() 0.0434s / foreach
Output for 5.4.40
0.2424s / array_map() 0.0555s / foreach
Output for 5.4.39
0.2345s / array_map() 0.0890s / foreach
Output for 5.4.38
0.0949s / array_map() 0.0459s / foreach
Output for 5.4.37
0.1804s / array_map() 0.0988s / foreach
Output for 5.4.36
0.1121s / array_map() 0.0912s / foreach
Output for 5.4.35
0.0965s / array_map() 0.0487s / foreach
Output for 5.4.34
0.0913s / array_map() 0.0515s / foreach
Output for 5.4.32
0.0489s / array_map() 0.0262s / foreach
Output for 5.4.31
0.0545s / array_map() 0.0315s / foreach
Output for 5.4.30
0.0543s / array_map() 0.0304s / foreach
Output for 5.4.29
0.0514s / array_map() 0.0273s / foreach
Output for 5.4.28
0.0543s / array_map() 0.0270s / foreach
Output for 5.4.27
0.0555s / array_map() 0.0271s / foreach
Output for 5.4.26
0.0525s / array_map() 0.0283s / foreach
Output for 5.4.25
0.0541s / array_map() 0.0278s / foreach
Output for 5.4.24
0.0510s / array_map() 0.0272s / foreach
Output for 5.4.23
0.0524s / array_map() 0.0267s / foreach
Output for 5.4.22
0.0498s / array_map() 0.0266s / foreach
Output for 5.4.21
0.0484s / array_map() 0.0266s / foreach
Output for 5.4.20
0.0622s / array_map() 0.0304s / foreach
Output for 5.4.19
0.0534s / array_map() 0.0322s / foreach
Output for 5.4.18
0.0544s / array_map() 0.0312s / foreach
Output for 5.4.17
0.0513s / array_map() 0.0309s / foreach
Output for 5.4.16
0.0558s / array_map() 0.0308s / foreach
Output for 5.4.15
0.0517s / array_map() 0.0283s / foreach
Output for 5.4.14
0.0534s / array_map() 0.0288s / foreach
Output for 5.4.13
0.0652s / array_map() 0.0396s / foreach
Output for 5.4.12
0.0554s / array_map() 0.0287s / foreach
Output for 5.4.11
0.0524s / array_map() 0.0279s / foreach
Output for 5.4.10
0.0505s / array_map() 0.0270s / foreach
Output for 5.4.9
0.0809s / array_map() 0.0308s / foreach
Output for 5.4.8
0.0533s / array_map() 0.0293s / foreach
Output for 5.4.7
0.0515s / array_map() 0.0281s / foreach
Output for 5.4.6
0.0511s / array_map() 0.0427s / foreach
Output for 5.4.5
0.0512s / array_map() 0.0273s / foreach
Output for 5.4.4
0.0526s / array_map() 0.0346s / foreach
Output for 5.4.3
0.0514s / array_map() 0.0269s / foreach
Output for 5.4.2
0.0501s / array_map() 0.0277s / foreach
Output for 5.4.1
0.0513s / array_map() 0.0289s / foreach
Output for 5.4.0
0.0520s / array_map() 0.0314s / foreach
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/ZrDXl on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/ZrDXl on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/ZrDXl on line 3
Process exited with code 255.