3v4l.org

run code in 300+ PHP versions simultaneously
<?php $all = []; for( $i=0; $i<2000; $i++ ) { for( $j=0; $j<500; $j++ ) { $all[$i][$j] = $j; } } $mergedArray = []; $start = microtime(true); foreach($all as &$templateClosingArray) { $mergedArray += $templateClosingArray; } $mergedArray = []; foreach($all as &$templateClosingArray) { $mergedArray += $templateClosingArray; } $mergedArray = []; foreach($all as &$templateClosingArray) { $mergedArray += $templateClosingArray; } echo PHP_EOL . 'Union time: ' . microtime(true); $start = microtime(true); $mergedArray = array_merge(...$all); $mergedArray = array_merge(...$all); $mergedArray = array_merge(...$all); echo PHP_EOL . 'Array merge time: ' . microtime(true);
Output for 8.4.14
Union time: 1761814622.0944 Array merge time: 1761814622.1277
Output for 8.4.13
Union time: 1761814622.0463 Array merge time: 1761814622.0754
Output for 8.4.12
Union time: 1761814622.0955 Array merge time: 1761814622.1273
Output for 8.4.11
Union time: 1761814622.0949 Array merge time: 1761814622.1609
Output for 8.4.10
Union time: 1761814622.1039 Array merge time: 1761814622.1451
Output for 8.4.9
Union time: 1761814622.0831 Array merge time: 1761814622.113
Output for 8.4.8
Union time: 1761814622.0905 Array merge time: 1761814622.1211
Output for 8.4.7
Union time: 1761814622.0988 Array merge time: 1761814622.1294
Output for 8.4.6
Union time: 1761814622.0929 Array merge time: 1761814622.1222
Output for 8.4.5
Union time: 1761814622.0485 Array merge time: 1761814622.0782
Output for 8.4.4
Union time: 1761814622.091 Array merge time: 1761814622.1266
Output for 8.4.3
Union time: 1761814622.084 Array merge time: 1761814622.1181
Output for 8.4.2
Union time: 1761814622.0929 Array merge time: 1761814622.1256
Output for 8.4.1
Union time: 1761814622.0985 Array merge time: 1761814622.134
Output for 8.3.27
Union time: 1761814622.0937 Array merge time: 1761814622.1565
Output for 8.3.26
Union time: 1761814622.0883 Array merge time: 1761814622.1177
Output for 8.3.25
Union time: 1761814622.0887 Array merge time: 1761814622.1205
Output for 8.3.24
Union time: 1761814622.0888 Array merge time: 1761814622.1193
Output for 8.3.23
Union time: 1761814622.045 Array merge time: 1761814622.075
Output for 8.3.22
Union time: 1761814622.0887 Array merge time: 1761814622.1225
Output for 8.3.21
Union time: 1761814622.0865 Array merge time: 1761814622.1173
Output for 8.3.20
Union time: 1761814622.0826 Array merge time: 1761814622.1154
Output for 8.3.19
Union time: 1761814622.0879 Array merge time: 1761814622.1364
Output for 8.3.18
Union time: 1761814622.0811 Array merge time: 1761814622.1111
Output for 8.3.17
Union time: 1761814622.0898 Array merge time: 1761814622.1221
Output for 8.3.16
Union time: 1761814622.0879 Array merge time: 1761814622.1179
Output for 8.3.15
Union time: 1761814622.0458 Array merge time: 1761814622.0747
Output for 8.3.14
Union time: 1761814622.045 Array merge time: 1761814622.0753
Output for 8.3.13
Union time: 1761814622.0425 Array merge time: 1761814622.0783
Output for 8.3.12
Union time: 1761814622.0511 Array merge time: 1761814622.0808
Output for 8.3.11
Union time: 1761814622.0571 Array merge time: 1761814622.086
Output for 8.3.10
Union time: 1761814622.0908 Array merge time: 1761814622.1241
Output for 8.3.9
Union time: 1761814622.0922 Array merge time: 1761814622.1271
Output for 8.3.8
Union time: 1761814622.0924 Array merge time: 1761814622.1255
Output for 8.3.7
Union time: 1761814622.106 Array merge time: 1761814622.1762
Output for 8.3.6
Union time: 1761814622.0834 Array merge time: 1761814622.1237
Output for 8.3.5
Union time: 1761814622.09 Array merge time: 1761814622.1241
Output for 8.2.4, 8.3.4
Union time: 1761814622.1024 Fatal error: Out of memory (allocated 27262976 bytes) (tried to allocate 16777224 bytes) in /in/3gQG2 on line 26 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.2.5, 8.3.3
Union time: 1761814622.0866 Fatal error: Out of memory (allocated 27262976 bytes) (tried to allocate 16777224 bytes) in /in/3gQG2 on line 26 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.3.2
Union time: 1761814622.0782 Fatal error: Out of memory (allocated 27262976 bytes) (tried to allocate 16777224 bytes) in /in/3gQG2 on line 26 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.3.1
Union time: 1761814622.0904 Fatal error: Out of memory (allocated 27262976 bytes) (tried to allocate 16777224 bytes) in /in/3gQG2 on line 26 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.3.0
Union time: 1761814622.0827 Fatal error: Out of memory (allocated 27262976 bytes) (tried to allocate 16777224 bytes) in /in/3gQG2 on line 26 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.2.29
Union time: 1761814622.0819 Array merge time: 1761814622.1135
Output for 8.2.28
Union time: 1761814622.0432 Array merge time: 1761814622.0774
Output for 8.2.27
Union time: 1761814622.0415 Array merge time: 1761814622.0707
Output for 8.2.26
Union time: 1761814622.0543 Array merge time: 1761814622.0895
Output for 8.2.25
Union time: 1761814622.0725 Array merge time: 1761814622.1017
Output for 8.2.24
Union time: 1761814622.0771 Array merge time: 1761814622.1061
Output for 8.2.23
Union time: 1761814622.0468 Array merge time: 1761814622.0817
Output for 8.2.22
Union time: 1761814622.082 Array merge time: 1761814622.1178
Output for 8.2.21
Union time: 1761814622.0866 Array merge time: 1761814622.1206
Output for 8.2.20
Union time: 1761814622.0895 Array merge time: 1761814622.121
Output for 8.2.19
Union time: 1761814622.0804 Array merge time: 1761814622.1119
Output for 8.2.18
Union time: 1761814622.0837 Array merge time: 1761814622.1193
Output for 8.2.17
Union time: 1761814622.087 Fatal error: Out of memory (allocated 27262976 bytes) (tried to allocate 16777224 bytes) in /in/3gQG2 on line 26 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.2.11, 8.2.16
Union time: 1761814622.0919 Fatal error: Out of memory (allocated 27262976 bytes) (tried to allocate 16777224 bytes) in /in/3gQG2 on line 26 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.2.15
Union time: 1761814622.0986 Fatal error: Out of memory (allocated 27262976 bytes) (tried to allocate 16777224 bytes) in /in/3gQG2 on line 26 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.2.14
Union time: 1761814622.0971 Fatal error: Out of memory (allocated 27262976 bytes) (tried to allocate 16777224 bytes) in /in/3gQG2 on line 26 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.2.13
Union time: 1761814622.0924 Fatal error: Out of memory (allocated 27262976 bytes) (tried to allocate 16777224 bytes) in /in/3gQG2 on line 26 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.2.12
Union time: 1761814622.1051 Fatal error: Out of memory (allocated 27262976 bytes) (tried to allocate 16777224 bytes) in /in/3gQG2 on line 26 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.2.10
Union time: 1761814622.091 Fatal error: Out of memory (allocated 27262976 bytes) (tried to allocate 16777224 bytes) in /in/3gQG2 on line 26 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.2.9
Union time: 1761814622.0911 Fatal error: Out of memory (allocated 27262976 bytes) (tried to allocate 16777224 bytes) in /in/3gQG2 on line 26 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.2.8
Union time: 1761814622.0898 Fatal error: Out of memory (allocated 27262976 bytes) (tried to allocate 16777224 bytes) in /in/3gQG2 on line 26 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.2.7
Union time: 1761814622.0936 Fatal error: Out of memory (allocated 27262976 bytes) (tried to allocate 16777224 bytes) in /in/3gQG2 on line 26 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.2.6
Union time: 1761814622.0951 Fatal error: Out of memory (allocated 27262976 bytes) (tried to allocate 16777224 bytes) in /in/3gQG2 on line 26 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.2.3
Union time: 1761814622.1005 Fatal error: Out of memory (allocated 27262976 bytes) (tried to allocate 16777224 bytes) in /in/3gQG2 on line 26 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.2.2
Union time: 1761814622.0985 Fatal error: Out of memory (allocated 27262976 bytes) (tried to allocate 16777224 bytes) in /in/3gQG2 on line 26 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.2.1
Union time: 1761814622.0954 Fatal error: Out of memory (allocated 27262976 bytes) (tried to allocate 16777224 bytes) in /in/3gQG2 on line 26 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.2.0
Union time: 1761814622.0899 Fatal error: Out of memory (allocated 27262976 bytes) (tried to allocate 16777224 bytes) in /in/3gQG2 on line 26 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.

preferences:
46.64 ms | 511 KiB | 5 Q